diff options
author | Vladimir Davydov <vdavydov@parallels.com> | 2015-02-12 17:58:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-12 21:54:09 -0500 |
commit | cb731d6c62bbc2f890b08ea3d0386d5dad887326 (patch) | |
tree | 1c597a1018d8258585aa65b3c4872a9c5d177d46 /include/linux/shrinker.h | |
parent | 4101b624352fddb5ed72e7a1b6f8be8cffaa20fa (diff) |
vmscan: per memory cgroup slab shrinkers
This patch adds SHRINKER_MEMCG_AWARE flag. If a shrinker has this flag
set, it will be called per memory cgroup. The memory cgroup to scan
objects from is passed in shrink_control->memcg. If the memory cgroup
is NULL, a memcg aware shrinker is supposed to scan objects from the
global list. Unaware shrinkers are only called on global pressure with
memcg=NULL.
Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Greg Thelen <gthelen@google.com>
Cc: Glauber Costa <glommer@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/shrinker.h')
-rw-r--r-- | include/linux/shrinker.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h index f4aee75f00b1..4fcacd915d45 100644 --- a/include/linux/shrinker.h +++ b/include/linux/shrinker.h | |||
@@ -20,6 +20,9 @@ struct shrink_control { | |||
20 | 20 | ||
21 | /* current node being shrunk (for NUMA aware shrinkers) */ | 21 | /* current node being shrunk (for NUMA aware shrinkers) */ |
22 | int nid; | 22 | int nid; |
23 | |||
24 | /* current memcg being shrunk (for memcg aware shrinkers) */ | ||
25 | struct mem_cgroup *memcg; | ||
23 | }; | 26 | }; |
24 | 27 | ||
25 | #define SHRINK_STOP (~0UL) | 28 | #define SHRINK_STOP (~0UL) |
@@ -61,7 +64,8 @@ struct shrinker { | |||
61 | #define DEFAULT_SEEKS 2 /* A good number if you don't know better. */ | 64 | #define DEFAULT_SEEKS 2 /* A good number if you don't know better. */ |
62 | 65 | ||
63 | /* Flags */ | 66 | /* Flags */ |
64 | #define SHRINKER_NUMA_AWARE (1 << 0) | 67 | #define SHRINKER_NUMA_AWARE (1 << 0) |
68 | #define SHRINKER_MEMCG_AWARE (1 << 1) | ||
65 | 69 | ||
66 | extern int register_shrinker(struct shrinker *); | 70 | extern int register_shrinker(struct shrinker *); |
67 | extern void unregister_shrinker(struct shrinker *); | 71 | extern void unregister_shrinker(struct shrinker *); |