Skip to content

Commit 271dd6b

Browse files
Muchun Songtorvalds
authored andcommitted
mm: memcontrol: move obj_cgroup_uncharge_pages() out of css_set_lock
The css_set_lock is used to guard the list of inherited objcgs. So there is no need to uncharge kernel memory under css_set_lock. Just move it out of the lock. Link: https://lkml.kernel.org/r/20210417043538.9793-8-songmuchun@bytedance.com Signed-off-by: Muchun Song <songmuchun@bytedance.com> Reviewed-by: Shakeel Butt <shakeelb@google.com> Acked-by: Roman Gushchin <guro@fb.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Vladimir Davydov <vdavydov.dev@gmail.com> Cc: Xiongchun Duan <duanxiongchun@bytedance.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9838354 commit 271dd6b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mm/memcontrol.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,10 @@ static void obj_cgroup_release(struct percpu_ref *ref)
289289
WARN_ON_ONCE(nr_bytes & (PAGE_SIZE - 1));
290290
nr_pages = nr_bytes >> PAGE_SHIFT;
291291

292-
spin_lock_irqsave(&css_set_lock, flags);
293292
if (nr_pages)
294293
obj_cgroup_uncharge_pages(objcg, nr_pages);
294+
295+
spin_lock_irqsave(&css_set_lock, flags);
295296
list_del(&objcg->list);
296297
spin_unlock_irqrestore(&css_set_lock, flags);
297298

0 commit comments

Comments
 (0)