提交 ae23395d 编写于 作者: D Dave Chinner 提交者: Darrick J. Wong

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: NDave Chinner <dchinner@redhat.com>
Reviewed-by: NJan Kara <jack@suse.cz>
Reviewed-by: NCarlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
上级 a78ee256
...@@ -346,9 +346,8 @@ void inc_nlink(struct inode *inode) ...@@ -346,9 +346,8 @@ void inc_nlink(struct inode *inode)
} }
EXPORT_SYMBOL(inc_nlink); EXPORT_SYMBOL(inc_nlink);
void address_space_init_once(struct address_space *mapping) static void __address_space_init_once(struct address_space *mapping)
{ {
memset(mapping, 0, sizeof(*mapping));
INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC | __GFP_ACCOUNT); INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC | __GFP_ACCOUNT);
spin_lock_init(&mapping->tree_lock); spin_lock_init(&mapping->tree_lock);
init_rwsem(&mapping->i_mmap_rwsem); init_rwsem(&mapping->i_mmap_rwsem);
...@@ -356,6 +355,12 @@ void address_space_init_once(struct address_space *mapping) ...@@ -356,6 +355,12 @@ void address_space_init_once(struct address_space *mapping)
spin_lock_init(&mapping->private_lock); spin_lock_init(&mapping->private_lock);
mapping->i_mmap = RB_ROOT_CACHED; mapping->i_mmap = RB_ROOT_CACHED;
} }
void address_space_init_once(struct address_space *mapping)
{
memset(mapping, 0, sizeof(*mapping));
__address_space_init_once(mapping);
}
EXPORT_SYMBOL(address_space_init_once); EXPORT_SYMBOL(address_space_init_once);
/* /*
...@@ -371,7 +376,7 @@ void inode_init_once(struct inode *inode) ...@@ -371,7 +376,7 @@ void inode_init_once(struct inode *inode)
INIT_LIST_HEAD(&inode->i_io_list); INIT_LIST_HEAD(&inode->i_io_list);
INIT_LIST_HEAD(&inode->i_wb_list); INIT_LIST_HEAD(&inode->i_wb_list);
INIT_LIST_HEAD(&inode->i_lru); INIT_LIST_HEAD(&inode->i_lru);
address_space_init_once(&inode->i_data); __address_space_init_once(&inode->i_data);
i_size_ordered_init(inode); i_size_ordered_init(inode);
} }
EXPORT_SYMBOL(inode_init_once); EXPORT_SYMBOL(inode_init_once);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册