mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 06:14:39 +01:00
memcg: avoid refill_stock for root memcg
We never charge the page counters of root memcg, so there is no need to put root memcg in the memcg stock. At the moment, refill_stock() can be called from try_charge_memcg(), obj_cgroup_uncharge_pages() and mem_cgroup_uncharge_skmem(). The try_charge_memcg() and mem_cgroup_uncharge_skmem() are never called with root memcg, so those are fine. However obj_cgroup_uncharge_pages() can potentially call refill_stock() with root memcg if the objcg object has been reparented over to the root memcg. Let's just avoid refill_stock() from obj_cgroup_uncharge_pages() for root memcg. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Shakeel Butt <[email protected]> Acked-by: Michal Hocko <[email protected]> Acked-by: Johannes Weiner <[email protected]> Cc: Muchun Song <[email protected]> Cc: Roman Gushchin <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
This commit is contained in:
1 parent
b4f65dbdf8
commit
20d6c17252
1 file changed
+2
-1
+2
-1
@@ -2643,7 +2643,8 @@ static void obj_cgroup_uncharge_pages(struct obj_cgroup *objcg,
|
||||
|
||||
mod_memcg_state(memcg, MEMCG_KMEM, -nr_pages);
|
||||
memcg1_account_kmem(memcg, -nr_pages);
|
||||
refill_stock(memcg, nr_pages);
|
||||
if (!mem_cgroup_is_root(memcg))
|
||||
refill_stock(memcg, nr_pages);
|
||||
|
||||
css_put(&memcg->css);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user