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
49 bool bd_write_holder;49 bool bd_write_holder;
50 bool bd_has_submit_bio;50 bool bd_has_submit_bio;
51 dev_t bd_dev;51 dev_t bd_dev;
52 struct inode *bd_inode; /* will die */
53
52 atomic_t bd_openers;54 atomic_t bd_openers;
53 spinlock_t bd_size_lock; /* for bd_inode->i_size updates */55 spinlock_t bd_size_lock; /* for bd_inode->i_size updates */
54 struct inode * bd_inode; /* will die */
55 void * bd_claiming;56 void * bd_claiming;
56 void * bd_holder;57 void * bd_holder;
57 const struct blk_holder_ops *bd_holder_ops;58 const struct blk_holder_ops *bd_holder_ops;