diff options
author | Dave Chinner <dchinner@redhat.com> | 2018-03-06 20:30:34 -0500 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-03-11 23:27:56 -0400 |
commit | ae23395d8858a0c91de978a60b317ec8468b2aba (patch) | |
tree | e5fbc63f66da6f754dde9a57d8952b511190bffa /fs/inode.c | |
parent | a78ee256c325ecfaec13cafc41b315bd4e1dd518 (diff) |
inode: don't memset the inode address space twice
Noticed when looking at why cycling 600k inodes/s through the inode
cache was taking a total of 8% cpu in memset() during inode
initialisation. There is no need to zero the inode.i_data structure
twice.
This increases single threaded bulkstat throughput from ~200,000
inodes/s to ~220,000 inodes/s, so we save a substantial amount of
CPU time per inode init by doing this.
Signed-Off-By: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/inode.c b/fs/inode.c index 6295f1415761..b153aeaa61ea 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -346,9 +346,8 @@ void inc_nlink(struct inode *inode) | |||
346 | } | 346 | } |
347 | EXPORT_SYMBOL(inc_nlink); | 347 | EXPORT_SYMBOL(inc_nlink); |
348 | 348 | ||
349 | void address_space_init_once(struct address_space *mapping) | 349 | static void __address_space_init_once(struct address_space *mapping) |
350 | { | 350 | { |
351 | memset(mapping, 0, sizeof(*mapping)); | ||
352 | INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC | __GFP_ACCOUNT); | 351 | INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC | __GFP_ACCOUNT); |
353 | spin_lock_init(&mapping->tree_lock); | 352 | spin_lock_init(&mapping->tree_lock); |
354 | init_rwsem(&mapping->i_mmap_rwsem); | 353 | init_rwsem(&mapping->i_mmap_rwsem); |
@@ -356,6 +355,12 @@ void address_space_init_once(struct address_space *mapping) | |||
356 | spin_lock_init(&mapping->private_lock); | 355 | spin_lock_init(&mapping->private_lock); |
357 | mapping->i_mmap = RB_ROOT_CACHED; | 356 | mapping->i_mmap = RB_ROOT_CACHED; |
358 | } | 357 | } |
358 | |||
359 | void address_space_init_once(struct address_space *mapping) | ||
360 | { | ||
361 | memset(mapping, 0, sizeof(*mapping)); | ||
362 | __address_space_init_once(mapping); | ||
363 | } | ||
359 | EXPORT_SYMBOL(address_space_init_once); | 364 | EXPORT_SYMBOL(address_space_init_once); |
360 | 365 | ||
361 | /* | 366 | /* |
@@ -371,7 +376,7 @@ void inode_init_once(struct inode *inode) | |||
371 | INIT_LIST_HEAD(&inode->i_io_list); | 376 | INIT_LIST_HEAD(&inode->i_io_list); |
372 | INIT_LIST_HEAD(&inode->i_wb_list); | 377 | INIT_LIST_HEAD(&inode->i_wb_list); |
373 | INIT_LIST_HEAD(&inode->i_lru); | 378 | INIT_LIST_HEAD(&inode->i_lru); |
374 | address_space_init_once(&inode->i_data); | 379 | __address_space_init_once(&inode->i_data); |
375 | i_size_ordered_init(inode); | 380 | i_size_ordered_init(inode); |
376 | } | 381 | } |
377 | EXPORT_SYMBOL(inode_init_once); | 382 | EXPORT_SYMBOL(inode_init_once); |