[Devel] [PATCH rh7] mm: Add RCU read brackets into memcg_uncharge_kmem()
Kirill Tkhai
ktkhai at virtuozzo.com
Thu May 7 12:18:47 MSK 2020
Potentially, here can be last css refcnt, so we should
have stable memory to access parent pointer.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
mm/memcontrol.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 797cb8e6df6d..d83908598ad1 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3518,6 +3518,7 @@ void memcg_uncharge_kmem(struct mem_cgroup *memcg,
if (kmem)
return;
+ rcu_read_lock();
/*
* Releases a reference taken in memcg_deactivate_kmem in case
* this last uncharge is racing with the offlining code or it is
@@ -3541,6 +3542,7 @@ void memcg_uncharge_kmem(struct mem_cgroup *memcg,
else
break;
}
+ rcu_read_unlock();
}
int __memcg_charge_slab(struct kmem_cache *s, gfp_t gfp, unsigned int nr_pages)
More information about the Devel
mailing list