* + mm-percpu-prevent-concurrency-problem-for-pcpu_nr_populated-read-with-spin-lock.patch added to mm-unstable branch
@ 2025-07-03 21:39 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-07-03 21:39 UTC (permalink / raw)
To: mm-commits, vbabka, tj, shakeel.butt, roman.gushchin, rientjes,
dennis, cl, aha310510, akpm
The patch titled
Subject: mm/percpu: prevent concurrency problem for pcpu_nr_populated read with spin lock
has been added to the -mm mm-unstable branch. Its filename is
mm-percpu-prevent-concurrency-problem-for-pcpu_nr_populated-read-with-spin-lock.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-percpu-prevent-concurrency-problem-for-pcpu_nr_populated-read-with-spin-lock.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Jeongjun Park <aha310510@gmail.com>
Subject: mm/percpu: prevent concurrency problem for pcpu_nr_populated read with spin lock
Date: Thu, 3 Jul 2025 15:56:00 +0900
pcpu_nr_pages() reads pcpu_nr_populated without any protection, which
causes a data race between read/write.
However, since this is an intended race, we should add a data_race
annotation instead of add a spin lock.
Link: https://lkml.kernel.org/r/20250703065600.132221-1-aha310510@gmail.com
Fixes: 7e8a6304d541 ("/proc/meminfo: add percpu populated pages count")
Signed-off-by: Jeongjun Park <aha310510@gmail.com>
Reported-by: syzbot+e5bd32b79413e86f389e@syzkaller.appspotmail.com
Suggested-by: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Christoph Lameter (Ampere) <cl@gentwo.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Tejun Heo <tj@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/percpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/mm/percpu.c~mm-percpu-prevent-concurrency-problem-for-pcpu_nr_populated-read-with-spin-lock
+++ a/mm/percpu.c
@@ -3355,7 +3355,7 @@ void __init setup_per_cpu_areas(void)
*/
unsigned long pcpu_nr_pages(void)
{
- return pcpu_nr_populated * pcpu_nr_units;
+ return data_race(READ_ONCE(pcpu_nr_populated) * pcpu_nr_units);
}
/*
_
Patches currently in -mm which might be from aha310510@gmail.com are
mm-maps-execute-procmap_query-ioctl-under-per-vma-locks-fix.patch
mm-percpu-prevent-concurrency-problem-for-pcpu_nr_populated-read-with-spin-lock.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-07-03 21:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03 21:39 + mm-percpu-prevent-concurrency-problem-for-pcpu_nr_populated-read-with-spin-lock.patch added to mm-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.