mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
b15aac110a
commit
567e9ab2e6
4 changed files with 38 additions and 35 deletions
|
@ -152,6 +152,12 @@ struct mem_cgroup_thresholds {
|
|||
struct mem_cgroup_threshold_ary *spare;
|
||||
};
|
||||
|
||||
enum memcg_kmem_state {
|
||||
KMEM_NONE,
|
||||
KMEM_ALLOCATED,
|
||||
KMEM_ONLINE,
|
||||
};
|
||||
|
||||
/*
|
||||
* The memory controller data structure. The memory controller controls both
|
||||
* page cache and RSS per cgroup. We would eventually like to provide
|
||||
|
@ -233,8 +239,7 @@ struct mem_cgroup {
|
|||
#if defined(CONFIG_MEMCG_KMEM)
|
||||
/* Index in the kmem_cache->memcg_params.memcg_caches array */
|
||||
int kmemcg_id;
|
||||
bool kmem_acct_activated;
|
||||
bool kmem_acct_active;
|
||||
enum memcg_kmem_state kmem_state;
|
||||
#endif
|
||||
|
||||
int last_scanned_node;
|
||||
|
@ -750,9 +755,9 @@ static inline bool memcg_kmem_enabled(void)
|
|||
return static_branch_unlikely(&memcg_kmem_enabled_key);
|
||||
}
|
||||
|
||||
static inline bool memcg_kmem_is_active(struct mem_cgroup *memcg)
|
||||
static inline bool memcg_kmem_online(struct mem_cgroup *memcg)
|
||||
{
|
||||
return memcg->kmem_acct_active;
|
||||
return memcg->kmem_state == KMEM_ONLINE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -850,7 +855,7 @@ static inline bool memcg_kmem_enabled(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline bool memcg_kmem_is_active(struct mem_cgroup *memcg)
|
||||
static inline bool memcg_kmem_online(struct mem_cgroup *memcg)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue