]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
memcg: make count_memcg_events re-entrant safe against irqs
authorShakeel Butt <shakeel.butt@linux.dev>
Wed, 14 May 2025 18:41:55 +0000 (11:41 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 22 May 2025 21:55:38 +0000 (14:55 -0700)
commite52401e7247bb36cabba389ae32fb75a12a6e94b
tree1c84901a267d70581f8d8ecb4259b52ab312ee46
parent8814e3b8692b31e0150a894dd70c14ca0b7b746a
memcg: make count_memcg_events re-entrant safe against irqs

Let's make count_memcg_events re-entrant safe against irqs.  The only
thing needed is to convert the usage of __this_cpu_add() to
this_cpu_add().  In addition, with re-entrant safety, there is no need to
disable irqs.  Also add warnings for in_nmi() as it is not safe against
nmi context.

Link: https://lkml.kernel.org/r/20250514184158.3471331-5-shakeel.butt@linux.dev
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/memcontrol.h
mm/memcontrol-v1.c
mm/memcontrol.c
mm/swap.c
mm/vmscan.c