diff options
author | Dave Chinner <dchinner@redhat.com> | 2015-03-04 12:37:22 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fb.com> | 2015-08-17 18:39:46 -0400 |
commit | 74278da9f70d84d715601fe794567a6d2bfdf078 (patch) | |
tree | 49262a88fc42b85bfe4930f5cd7a832d5ba647c6 /fs/drop_caches.c | |
parent | cbedaac63481dea52327127a9f1c60f092bd6b07 (diff) |
inode: convert inode_sb_list_lock to per-sb
The process of reducing contention on per-superblock inode lists
starts with moving the locking to match the per-superblock inode
list. This takes the global lock out of the picture and reduces the
contention problems to within a single filesystem. This doesn't get
rid of contention as the locks still have global CPU scope, but it
does isolate operations on different superblocks form each other.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/drop_caches.c')
-rw-r--r-- | fs/drop_caches.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/drop_caches.c b/fs/drop_caches.c index 5718cb9f7273..d72d52b90433 100644 --- a/fs/drop_caches.c +++ b/fs/drop_caches.c | |||
@@ -17,7 +17,7 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused) | |||
17 | { | 17 | { |
18 | struct inode *inode, *toput_inode = NULL; | 18 | struct inode *inode, *toput_inode = NULL; |
19 | 19 | ||
20 | spin_lock(&inode_sb_list_lock); | 20 | spin_lock(&sb->s_inode_list_lock); |
21 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { | 21 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { |
22 | spin_lock(&inode->i_lock); | 22 | spin_lock(&inode->i_lock); |
23 | if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) || | 23 | if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) || |
@@ -27,13 +27,15 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused) | |||
27 | } | 27 | } |
28 | __iget(inode); | 28 | __iget(inode); |
29 | spin_unlock(&inode->i_lock); | 29 | spin_unlock(&inode->i_lock); |
30 | spin_unlock(&inode_sb_list_lock); | 30 | spin_unlock(&sb->s_inode_list_lock); |
31 | |||
31 | invalidate_mapping_pages(inode->i_mapping, 0, -1); | 32 | invalidate_mapping_pages(inode->i_mapping, 0, -1); |
32 | iput(toput_inode); | 33 | iput(toput_inode); |
33 | toput_inode = inode; | 34 | toput_inode = inode; |
34 | spin_lock(&inode_sb_list_lock); | 35 | |
36 | spin_lock(&sb->s_inode_list_lock); | ||
35 | } | 37 | } |
36 | spin_unlock(&inode_sb_list_lock); | 38 | spin_unlock(&sb->s_inode_list_lock); |
37 | iput(toput_inode); | 39 | iput(toput_inode); |
38 | } | 40 | } |
39 | 41 | ||