aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memcontrol.h
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2016-01-20 18:02:24 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-20 20:09:18 -0500
commit567e9ab2e614e55feca20e8bcb54b629e9cc1a3b (patch)
tree4a76642946268e850fdab5b757f9e5bfa2ea07b6 /include/linux/memcontrol.h
parentb15aac110a45c52d7f47ab8ee2d68f98044cfe6c (diff)
mm: memcontrol: give the kmem states more descriptive names
On any given memcg, the kmem accounting feature has three separate states: not initialized, structures allocated, and actively accounting slab memory. These are represented through a combination of the kmem_acct_activated and kmem_acct_active flags, which is confusing. Convert to a kmem_state enum with the states NONE, ALLOCATED, and ONLINE. Then rename the functions to modify the state accordingly. This follows the nomenclature of css object states more closely. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Tejun Heo <tj@kernel.org> Acked-by: Vladimir Davydov <vdavydov@virtuozzo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/memcontrol.h')
-rw-r--r--include/linux/memcontrol.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 189f04d4d2ec..54dab4d43e6d 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -152,6 +152,12 @@ struct mem_cgroup_thresholds {
152 struct mem_cgroup_threshold_ary *spare; 152 struct mem_cgroup_threshold_ary *spare;
153}; 153};
154 154
155enum memcg_kmem_state {
156 KMEM_NONE,
157 KMEM_ALLOCATED,
158 KMEM_ONLINE,
159};
160
155/* 161/*
156 * The memory controller data structure. The memory controller controls both 162 * The memory controller data structure. The memory controller controls both
157 * page cache and RSS per cgroup. We would eventually like to provide 163 * page cache and RSS per cgroup. We would eventually like to provide
@@ -233,8 +239,7 @@ struct mem_cgroup {
233#if defined(CONFIG_MEMCG_KMEM) 239#if defined(CONFIG_MEMCG_KMEM)
234 /* Index in the kmem_cache->memcg_params.memcg_caches array */ 240 /* Index in the kmem_cache->memcg_params.memcg_caches array */
235 int kmemcg_id; 241 int kmemcg_id;
236 bool kmem_acct_activated; 242 enum memcg_kmem_state kmem_state;
237 bool kmem_acct_active;
238#endif 243#endif
239 244
240 int last_scanned_node; 245 int last_scanned_node;
@@ -750,9 +755,9 @@ static inline bool memcg_kmem_enabled(void)
750 return static_branch_unlikely(&memcg_kmem_enabled_key); 755 return static_branch_unlikely(&memcg_kmem_enabled_key);
751} 756}
752 757
753static inline bool memcg_kmem_is_active(struct mem_cgroup *memcg) 758static inline bool memcg_kmem_online(struct mem_cgroup *memcg)
754{ 759{
755 return memcg->kmem_acct_active; 760 return memcg->kmem_state == KMEM_ONLINE;
756} 761}
757 762
758/* 763/*
@@ -850,7 +855,7 @@ static inline bool memcg_kmem_enabled(void)
850 return false; 855 return false;
851} 856}
852 857
853static inline bool memcg_kmem_is_active(struct mem_cgroup *memcg) 858static inline bool memcg_kmem_online(struct mem_cgroup *memcg)
854{ 859{
855 return false; 860 return false;
856} 861}