diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-08-27 20:18:05 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-09-10 18:56:31 -0400 |
commit | 9b17c62382dd2e7507984b9890bf44e070cdd8bb (patch) | |
tree | e64979ddbd8f0b6924f6b940fa15804490301908 /fs/super.c | |
parent | 1d3d4437eae1bb2963faab427f65f90663c64aa1 (diff) |
fs: convert inode and dentry shrinking to be node aware
Now that the shrinker is passing a node in the scan control structure, we
can pass this to the the generic LRU list code to isolate reclaim to the
lists on matching nodes.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Glauber Costa <glommer@parallels.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Carlos Maiolino <cmaiolino@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Rientjes <rientjes@google.com>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: J. Bruce Fields <bfields@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Kent Overstreet <koverstreet@google.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/fs/super.c b/fs/super.c index cd3c2cd9144d..181d42e2abff 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -76,10 +76,10 @@ static unsigned long super_cache_scan(struct shrinker *shrink, | |||
76 | return SHRINK_STOP; | 76 | return SHRINK_STOP; |
77 | 77 | ||
78 | if (sb->s_op->nr_cached_objects) | 78 | if (sb->s_op->nr_cached_objects) |
79 | fs_objects = sb->s_op->nr_cached_objects(sb); | 79 | fs_objects = sb->s_op->nr_cached_objects(sb, sc->nid); |
80 | 80 | ||
81 | inodes = list_lru_count(&sb->s_inode_lru); | 81 | inodes = list_lru_count_node(&sb->s_inode_lru, sc->nid); |
82 | dentries = list_lru_count(&sb->s_dentry_lru); | 82 | dentries = list_lru_count_node(&sb->s_dentry_lru, sc->nid); |
83 | total_objects = dentries + inodes + fs_objects + 1; | 83 | total_objects = dentries + inodes + fs_objects + 1; |
84 | 84 | ||
85 | /* proportion the scan between the caches */ | 85 | /* proportion the scan between the caches */ |
@@ -90,13 +90,14 @@ static unsigned long super_cache_scan(struct shrinker *shrink, | |||
90 | * prune the dcache first as the icache is pinned by it, then | 90 | * prune the dcache first as the icache is pinned by it, then |
91 | * prune the icache, followed by the filesystem specific caches | 91 | * prune the icache, followed by the filesystem specific caches |
92 | */ | 92 | */ |
93 | freed = prune_dcache_sb(sb, dentries); | 93 | freed = prune_dcache_sb(sb, dentries, sc->nid); |
94 | freed += prune_icache_sb(sb, inodes); | 94 | freed += prune_icache_sb(sb, inodes, sc->nid); |
95 | 95 | ||
96 | if (fs_objects) { | 96 | if (fs_objects) { |
97 | fs_objects = mult_frac(sc->nr_to_scan, fs_objects, | 97 | fs_objects = mult_frac(sc->nr_to_scan, fs_objects, |
98 | total_objects); | 98 | total_objects); |
99 | freed += sb->s_op->free_cached_objects(sb, fs_objects); | 99 | freed += sb->s_op->free_cached_objects(sb, fs_objects, |
100 | sc->nid); | ||
100 | } | 101 | } |
101 | 102 | ||
102 | drop_super(sb); | 103 | drop_super(sb); |
@@ -115,10 +116,13 @@ static unsigned long super_cache_count(struct shrinker *shrink, | |||
115 | return 0; | 116 | return 0; |
116 | 117 | ||
117 | if (sb->s_op && sb->s_op->nr_cached_objects) | 118 | if (sb->s_op && sb->s_op->nr_cached_objects) |
118 | total_objects = sb->s_op->nr_cached_objects(sb); | 119 | total_objects = sb->s_op->nr_cached_objects(sb, |
120 | sc->nid); | ||
119 | 121 | ||
120 | total_objects += list_lru_count(&sb->s_dentry_lru); | 122 | total_objects += list_lru_count_node(&sb->s_dentry_lru, |
121 | total_objects += list_lru_count(&sb->s_inode_lru); | 123 | sc->nid); |
124 | total_objects += list_lru_count_node(&sb->s_inode_lru, | ||
125 | sc->nid); | ||
122 | 126 | ||
123 | total_objects = vfs_pressure_ratio(total_objects); | 127 | total_objects = vfs_pressure_ratio(total_objects); |
124 | drop_super(sb); | 128 | drop_super(sb); |
@@ -228,6 +232,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags) | |||
228 | s->s_shrink.scan_objects = super_cache_scan; | 232 | s->s_shrink.scan_objects = super_cache_scan; |
229 | s->s_shrink.count_objects = super_cache_count; | 233 | s->s_shrink.count_objects = super_cache_count; |
230 | s->s_shrink.batch = 1024; | 234 | s->s_shrink.batch = 1024; |
235 | s->s_shrink.flags = SHRINKER_NUMA_AWARE; | ||
231 | } | 236 | } |
232 | out: | 237 | out: |
233 | return s; | 238 | return s; |