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.
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -49,9 +49,10 @@ struct block_device { · 48 unmodified lines | ||
| 49 | 49 | bool bd_write_holder; |
| 50 | 50 | bool bd_has_submit_bio; |
| 51 | 51 | dev_t bd_dev; |
| 52 | + struct inode *bd_inode; /* will die */ | |
| 53 | + | |
| 52 | 54 | atomic_t bd_openers; |
| 53 | 55 | spinlock_t bd_size_lock; /* for bd_inode->i_size updates */ |
| 54 | − struct inode * bd_inode; /* will die */ | |
| 55 | 56 | void * bd_claiming; |
| 56 | 57 | void * bd_holder; |
| 57 | 58 | const struct blk_holder_ops *bd_holder_ops; |