summaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2018-10-18 07:22:55 -0400
committerJan Kara <jack@suse.cz>2018-10-19 08:45:36 -0400
commit99c228a994ec8b1580c43631866fd2c5440f5bfd (patch)
tree9bdd71f027d1046080cd4242c2251f08e0a7d6db /include/linux/fs.h
parentd0a6a87e40da49cfc7954c491d3065a25a641b29 (diff)
fs: group frequently accessed fields of struct super_block together
Kernel test robot reported [1] a 6% performance regression in a concurrent unlink(2) workload on commit 60f7ed8c7c4d ("fsnotify: send path type events to group with super block marks"). The performance test was run with no fsnotify marks at all on the data set, so the only extra instructions added by the offending commit are tests of the super_block fields s_fsnotify_{marks,mask} and these tests happen on almost every single inode access. When adding those fields to the super_block struct, we did not give much thought of placing them on a hot cache lines (we just placed them at the end of the struct). Re-organize struct super_block to try and keep some frequently accessed fields on the same cache line. Move the frequently accessed fields s_fsnotify_{marks,mask} near the frequently accessed fields s_fs_info,s_time_gran, while filling a 64bit alignment hole after s_time_gran. Move the seldom accessed fields s_id,s_uuid,s_max_links,s_mode near the seldom accessed fields s_vfs_rename_mutex,s_subtype. Rong Chen confirmed that this patch solved the reported problem. [1] https://lkml.org/lkml/2018/9/30/206 Reported-by: kernel test robot <rong.a.chen@intel.com> Tested-by: kernel test robot <rong.a.chen@intel.com> Fixes: 1e6cb72399 ("fsnotify: add super block object type") Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2c14801d0aa3..6da94deb957f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1393,17 +1393,26 @@ struct super_block {
1393 1393
1394 struct sb_writers s_writers; 1394 struct sb_writers s_writers;
1395 1395
1396 /*
1397 * Keep s_fs_info, s_time_gran, s_fsnotify_mask, and
1398 * s_fsnotify_marks together for cache efficiency. They are frequently
1399 * accessed and rarely modified.
1400 */
1401 void *s_fs_info; /* Filesystem private info */
1402
1403 /* Granularity of c/m/atime in ns (cannot be worse than a second) */
1404 u32 s_time_gran;
1405#ifdef CONFIG_FSNOTIFY
1406 __u32 s_fsnotify_mask;
1407 struct fsnotify_mark_connector __rcu *s_fsnotify_marks;
1408#endif
1409
1396 char s_id[32]; /* Informational name */ 1410 char s_id[32]; /* Informational name */
1397 uuid_t s_uuid; /* UUID */ 1411 uuid_t s_uuid; /* UUID */
1398 1412
1399 void *s_fs_info; /* Filesystem private info */
1400 unsigned int s_max_links; 1413 unsigned int s_max_links;
1401 fmode_t s_mode; 1414 fmode_t s_mode;
1402 1415
1403 /* Granularity of c/m/atime in ns.
1404 Cannot be worse than a second */
1405 u32 s_time_gran;
1406
1407 /* 1416 /*
1408 * The next field is for VFS *only*. No filesystems have any business 1417 * The next field is for VFS *only*. No filesystems have any business
1409 * even looking at it. You had been warned. 1418 * even looking at it. You had been warned.
@@ -1464,11 +1473,6 @@ struct super_block {
1464 1473
1465 spinlock_t s_inode_wblist_lock; 1474 spinlock_t s_inode_wblist_lock;
1466 struct list_head s_inodes_wb; /* writeback inodes */ 1475 struct list_head s_inodes_wb; /* writeback inodes */
1467
1468#ifdef CONFIG_FSNOTIFY
1469 __u32 s_fsnotify_mask;
1470 struct fsnotify_mark_connector __rcu *s_fsnotify_marks;
1471#endif
1472} __randomize_layout; 1476} __randomize_layout;
1473 1477
1474/* Helper functions so that in most cases filesystems will 1478/* Helper functions so that in most cases filesystems will