mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
mm: memcontrol: avoid unused function warning
am: 5fad174344
Change-Id: I6734d095131126260931a16a670c66ec58ba4896
This commit is contained in:
@@ -4150,24 +4150,6 @@ static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n)
|
||||
atomic_add(n, &memcg->id.ref);
|
||||
}
|
||||
|
||||
static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)
|
||||
{
|
||||
while (!atomic_inc_not_zero(&memcg->id.ref)) {
|
||||
/*
|
||||
* The root cgroup cannot be destroyed, so it's refcount must
|
||||
* always be >= 1.
|
||||
*/
|
||||
if (WARN_ON_ONCE(memcg == root_mem_cgroup)) {
|
||||
VM_BUG_ON(1);
|
||||
break;
|
||||
}
|
||||
memcg = parent_mem_cgroup(memcg);
|
||||
if (!memcg)
|
||||
memcg = root_mem_cgroup;
|
||||
}
|
||||
return memcg;
|
||||
}
|
||||
|
||||
static void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n)
|
||||
{
|
||||
if (atomic_sub_and_test(n, &memcg->id.ref)) {
|
||||
@@ -5751,6 +5733,24 @@ static int __init mem_cgroup_init(void)
|
||||
subsys_initcall(mem_cgroup_init);
|
||||
|
||||
#ifdef CONFIG_MEMCG_SWAP
|
||||
static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)
|
||||
{
|
||||
while (!atomic_inc_not_zero(&memcg->id.ref)) {
|
||||
/*
|
||||
* The root cgroup cannot be destroyed, so it's refcount must
|
||||
* always be >= 1.
|
||||
*/
|
||||
if (WARN_ON_ONCE(memcg == root_mem_cgroup)) {
|
||||
VM_BUG_ON(1);
|
||||
break;
|
||||
}
|
||||
memcg = parent_mem_cgroup(memcg);
|
||||
if (!memcg)
|
||||
memcg = root_mem_cgroup;
|
||||
}
|
||||
return memcg;
|
||||
}
|
||||
|
||||
/**
|
||||
* mem_cgroup_swapout - transfer a memsw charge to swap
|
||||
* @page: page whose memsw charge to transfer
|
||||
|
||||
Reference in New Issue
Block a user