Skip to contentSkip to conversation

mm-percpu-prevent-concurrency-problem-for-pcpu_nr_populated-read-with-spin-lock.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jul 13, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/percpu: prevent concurrency problem for pcpu_nr_populated read with spin lock
has been removed from the -mm tree. Its filename was
mm-percpu-prevent-concurrency-problem-for-pcpu_nr_populated-read-with-spin-lock.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Jeongjun Park <[email protected]>
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.

[[email protected]: move pcpu_nr_units multiplication outside data_race(), per Vlastimil]
Fixes 7e8a6304d541 ("/proc/meminfo: add percpu populated pages count")
Reported-by [email protected]
Cc Christoph Lameter (Ampere) <[email protected]>
Cc David Rientjes <[email protected]>
Cc Dennis Zhou <[email protected]>
Cc Roman Gushchin <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 mm/percpu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/percpu.c renamed from mm/percpu.c~mm-percpu-prevent-concurrency-problem-for-pcpu_nr_populated-read-with-spin-lock +1 -1
@@ -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 [email protected] are