History

block: move .bd_inode into 1st cacheline of block_device

The .bd_inode field of block_device is used in IO fast path of blkdev_write_iter() and blkdev_llseek(), so it is more efficient to keep it into the 1st cacheline. .bd_openers is only touched in open()/close(), and .bd_size_lock is only for updating bdev capacity, which is in slow path too. So swap .bd_inode layout with .bd_openers & .bd_size_lock to move .bd_inode into the 1st cache line.

Ming Lei committed 2 years ago

Commit fad907c1 parent bb6cc251 file · +2 −1Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/blk_types.h+2−1
@@ -49,9 +49,10 @@ struct block_device { · 48 unmodified lines
4949 bool bd_write_holder;
5050 bool bd_has_submit_bio;
5151 dev_t bd_dev;
52+ struct inode *bd_inode; /* will die */
53+
5254 atomic_t bd_openers;
5355 spinlock_t bd_size_lock; /* for bd_inode->i_size updates */
54− struct inode * bd_inode; /* will die */
5556 void * bd_claiming;
5657 void * bd_holder;
5758 const struct blk_holder_ops *bd_holder_ops;