In the test of execl, shell1 and shell8 of UnixBench, L3 false sharing
occurs between rwsem_try_write_lock_unqueued() and filemap_map_pages().
The offset between address_space.host and address_space.i_mmap_rwsem
is 48. It may occur L3 false sharing. Their offsets in struct ext4_inode_info
is 696 and 744, so when the address of ext4_inode_info after L3 aligned,
it may occur L3 false sharing in the following condition:
[0x00 ~ 0x10] false sharing
[0x18 ~ 0x40] no false sharing
[0x48 ~ 0x80] false sharing
Change the offset of 'vfs_inode' from 320 to 360 in ext4_inode_info and
make the address of ext4_inode_info L3 aligned, so the offset of host
and i_mmap_rwsem in ext4_inode_info is changed to 736 and 784, it can
make them in different L3 to avoid false sharing.
./Run -c 96 -i 3 execl
Before this patch:
System Benchmarks Partial Index BASELINE RESULT INDEX
Execl Throughput 43.0 24238.0 5636.8
========
System Benchmarks Index Score (Partial Only) 5636.8
After this patch:
System Benchmarks Partial Index BASELINE RESULT INDEX
Execl Throughput 43.0 29363.7 6828.8
========
System Benchmarks Index Score (Partial Only) 6828.8
Yang Yingliang (2):
ext4: mitigatin cacheline false sharing in struct ext4_inode_info
enable MITIGATION_FALSE_SHARING by default
arch/arm64/configs/openeuler_defconfig | 1 +
arch/x86/configs/openeuler_defconfig | 1 +
fs/ext4/Kconfig | 9 +++++++++
fs/ext4/ext4.h | 5 +++++
fs/ext4/super.c | 4 ++++
5 files changed, 20 insertions(+)
--
2.33.0