From: sashiko-bot@kernel.org
To: "Zhu Jun" <zhujun2@cmss.chinamobile.com>, akpm@linux-foundation.org
Cc: vbabka@kernel.org, hannes@cmpxchg.org, ziy@nvidia.com,
rostedt@goodmis.org, mhiramat@kernel.org, linux-mm@kvack.org,
linux-trace-kernel@vger.kernel.org,
syzbot+212c2d1f47994035cf7f@syzkaller.appspotmail.com
Subject: Re: [PATCH] mm/compaction: Mark concurrent compact_considered accesses
Date: Thu, 12 Nov 2026 08:42:16 +0000 [thread overview]
Message-ID: <sashiko-outbox-210762@kernel.org> (raw)
In-Reply-To: <20261111084205.80997-1-zhujun2@cmss.chinamobile.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] mm: data race in compaction_deferred() [1]
--
commit 065fba640e4d4df80527a642f4adcbe5f31c8683
Author: Zhu Jun <zhujun2@cmss.chinamobile.com>
mm/compaction: Mark concurrent compact_considered accesses
This commit marks concurrent reads and writes to zone->compact_considered
with READ_ONCE() and WRITE_ONCE() to avoid KCSAN data race reports.
> diff --git a/mm/compaction.c b/mm/compaction.c
> index a049415512c67..2ac6af7c1ee59 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -126,7 +126,7 @@ static unsigned long release_free_list(struct list_head *freepages)
> */
> static void defer_compaction(struct zone *zone, int order)
> {
> - zone->compact_considered = 0;
> + WRITE_ONCE(zone->compact_considered, 0);
> zone->compact_defer_shift++;
>
> if (order < zone->compact_order_failed)
> @@ -142,15 +142,16 @@ static void defer_compaction(struct zone *zone, int order)
> static bool compaction_deferred(struct zone *zone, int order)
> {
> unsigned long defer_limit = 1UL << zone->compact_defer_shift;
[Severity: Medium]
This problem wasn't introduced by this patch, but should concurrent
accesses to zone->compact_defer_shift also be marked to avoid a data race
[1]?
Multiple CPUs performing page allocations under memory pressure call
defer_compaction(), compaction_deferred(), compaction_defer_reset(), and
compaction_restarting() concurrently without a common lock, reading and
updating zone->compact_defer_shift via plain C accesses. This causes KCSAN
warnings and can corrupt compaction deferral limits.
[1] https://sashiko.dev/#/bug/linux-b61fd78e-8874-42f5-bbe1-bcd3914879cc
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261111084205.80997-1-zhujun2@cmss.chinamobile.com?part=1
prev parent reply other threads:[~2026-11-12 8:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 8:42 [PATCH] mm/compaction: Mark concurrent compact_considered accesses Zhu Jun
2026-11-11 8:51 ` Vlastimil Babka (SUSE)
2026-11-12 8:42 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-210762@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=syzbot+212c2d1f47994035cf7f@syzkaller.appspotmail.com \
--cc=vbabka@kernel.org \
--cc=zhujun2@cmss.chinamobile.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox