* [merged mm-stable] mm-annotate-data-race-in-cpu_needs_drain.patch removed from -mm tree
@ 2026-07-29 4:14 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-07-29 4:14 UTC (permalink / raw)
To: mm-commits, yuanchu, weixugc, vbabka, shikemeng, shakeel.butt,
pfalcato, nphamcs, ljs, liam, kasong, jannh, david, chrisl,
baoquan.he, baohua, axelrasmussen, wangxuewen, akpm
The quilt patch titled
Subject: mm: annotate data-race in cpu_needs_drain()
has been removed from the -mm tree. Its filename was
mm-annotate-data-race-in-cpu_needs_drain.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: Xuewen Wang <wangxuewen@kylinos.cn>
Subject: mm: annotate data-race in cpu_needs_drain()
Date: Fri, 26 Jun 2026 13:37:00 +0800
KCSAN reports a data-race when cpu_needs_drain() reads another CPU's
per-cpu folio_batch->nr without locking, while the owning CPU writes to it
via folio_batch_add().
Reading a slightly stale value is harmless -- cpu_needs_drain() only
decides whether to schedule a drain, and the next iteration of
__lru_add_drain_all() will re-check. Use data_race() to annotate the
intentional race.
[akpm@linux-foundation.org: reindent cpu_needs_drain, per David & Lorenzo]
Link: https://lore.kernel.org/20260626053700.2036899-1-wangxuewen@kylinos.cn
Signed-off-by: Xuewen Wang <wangxuewen@kylinos.cn>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Pedro Falcato <pfalcato@suse.de>
Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Baoquan He <baoquan.he@linux.dev>
Cc: Barry Song <baohua@kernel.org>
Cc: Chris Li <chrisl@kernel.org>
Cc: Jann Horn <jannh@google.com>
Cc: Kairui Song <kasong@tencent.com>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Wei Xu <weixugc@google.com>
Cc: Yuanchu Xie <yuanchu@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/swap.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
--- a/mm/swap.c~mm-annotate-data-race-in-cpu_needs_drain
+++ a/mm/swap.c
@@ -831,13 +831,13 @@ static bool cpu_needs_drain(unsigned int
struct cpu_fbatches *fbatches = &per_cpu(cpu_fbatches, cpu);
/* Check these in order of likelihood that they're not zero */
- return folio_batch_count(&fbatches->lru_add) ||
- folio_batch_count(&fbatches->lru_move_tail) ||
- folio_batch_count(&fbatches->lru_deactivate_file) ||
- folio_batch_count(&fbatches->lru_deactivate) ||
- folio_batch_count(&fbatches->lru_lazyfree) ||
- folio_batch_count(&fbatches->lru_activate) ||
- need_mlock_drain(cpu) ||
+ return data_race(folio_batch_count(&fbatches->lru_add) ||
+ folio_batch_count(&fbatches->lru_move_tail) ||
+ folio_batch_count(&fbatches->lru_deactivate_file) ||
+ folio_batch_count(&fbatches->lru_deactivate) ||
+ folio_batch_count(&fbatches->lru_lazyfree) ||
+ folio_batch_count(&fbatches->lru_activate) ||
+ need_mlock_drain(cpu)) ||
has_bh_in_lru(cpu, NULL);
}
_
Patches currently in -mm which might be from wangxuewen@kylinos.cn are
mm-damon-remove-trailing-semicolons-after-function-definitions.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-29 4:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29 4:14 [merged mm-stable] mm-annotate-data-race-in-cpu_needs_drain.patch removed from -mm tree 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.