Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Huan Nguyen" <nhuhuan@google.com>,
	tglx@kernel.org, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
	akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org,
	Liam.Howlett@oracle.com, vbabka@kernel.org, rppt@kernel.org,
	surenb@google.com, mhocko@suse.com, trondmy@kernel.org,
	anna@kernel.org, ziy@nvidia.com, matthew.brost@intel.com,
	joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com,
	gourry@gourry.net, ying.huang@linux.alibaba.com,
	apopple@nvidia.com, rostedt@goodmis.org, mhiramat@kernel.org,
	mathieu.desnoyers@efficios.com, jackmanb@google.com,
	hannes@cmpxchg.org, shivankg@amd.com
Cc: rientjes@google.com, dave@stgolabs.net, nifan.cxl@gmail.com,
	fvdl@google.com, jic23@kernel.org, rkodsara@amd.com,
	bharata@amd.com, sj@kernel.org, weixugc@google.com,
	xuezhengchu@huawei.com, yiannis@zptcorp.com,
	yiannis.nikolakop@gmail.com, dimitrios.palyvos@zptcorp.com,
	alirad.malek@zptcorp.com, ryan.roberts@arm.com,
	linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org,
	"Chuck Lever" <cel@kernel.org>,
	"Jeff Layton" <jlayton@kernel.org>
Subject: Re: [RFC PATCH v3 2/3] mm/migrate: introduce async non-temporal migration mode
Date: Wed, 04 Nov 2026 22:31:56 +0000	[thread overview]
Message-ID: <sashiko-outbox-198231@kernel.org> (raw)
In-Reply-To: <20261103223025.2482227-3-nhuhuan@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mm/compaction: enum migrate_mode ordering breaks compact_zone() async check
--

commit 047765d971a4b565eac5e2dd50bc528791c2e77e
Author: Huan Nguyen <nhuhuan@google.com>

mm/migrate: introduce async non-temporal migration mode

This commit introduces MIGRATE_ASYNC_NONTEMPORAL to migrate cold folios
using non-temporal stores via folio_mc_copy_nt() in __migrate_folio(), and
adds migrate_is_async() to update callers across compaction, NFS, and
migration.

> diff --git a/include/linux/migrate_mode.h b/include/linux/migrate_mode.h
> index 05102d4d2490e..fd752fddc972e 100644
> --- a/include/linux/migrate_mode.h
> +++ b/include/linux/migrate_mode.h
> @@ -12,6 +12,7 @@ enum migrate_mode {
>  	MIGRATE_ASYNC,
>  	MIGRATE_SYNC_LIGHT,
>  	MIGRATE_SYNC,
> +	MIGRATE_ASYNC_NONTEMPORAL,
>  };

[Severity: Medium]
Does placing MIGRATE_ASYNC_NONTEMPORAL after MIGRATE_SYNC in enum
migrate_mode break the relational check in compact_zone()?

In mm/compaction.c, compact_zone() checks (cc->mode < MIGRATE_SYNC) when a
page fails to migrate within a pageblock:

mm/compaction.c:compact_zone() {
    ...
			/*
			 * If an ASYNC or SYNC_LIGHT fails to migrate a page
			 * within the pageblock_order-aligned block and
			 * fast_find_migrateblock may be used then scan the
			 * remainder of the pageblock.
			 * ...
			 */
			if (!pageblock_aligned(cc->migrate_pfn) &&
			    !cc->ignore_skip_hint && !cc->finish_pageblock &&
			    (cc->mode < MIGRATE_SYNC)) {
				cc->finish_pageblock = true;
    ...
				goto rescan;
			}
    ...
}

Because MIGRATE_ASYNC_NONTEMPORAL has an enum value greater than
MIGRATE_SYNC, (cc->mode < MIGRATE_SYNC) evaluates to false when compact_zone()
runs with cc->mode == MIGRATE_ASYNC_NONTEMPORAL and migration fails
mid-pageblock. That causes compact_zone() to skip setting
cc->finish_pageblock = true and jumping to rescan, leaving the pageblock
partially scanned without marking it skip so fast_find_migrateblock() can
repeatedly revisit it.

Should MIGRATE_ASYNC_NONTEMPORAL be placed before MIGRATE_SYNC_LIGHT in enum
migrate_mode (matching the ordering in include/trace/events/migrate.h), or
should compact_zone() check cc->mode != MIGRATE_SYNC like
isolate_migratepages() does?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261103223025.2482227-1-nhuhuan@google.com?part=2


  reply	other threads:[~2026-11-04 22:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 15:02 [PATCH RFC v2 0/3] Demote to lower tier using non-temporal stores Yiannis Nikolakopoulos
2026-07-30 15:02 ` [PATCH RFC v2 1/3] mm, x86: support copying a folio " Yiannis Nikolakopoulos
2026-07-31 21:53   ` Huan Nguyen
2026-08-17 16:34     ` Garg, Shivank
2026-07-30 15:02 ` [PATCH RFC v2 2/3] mm: new migrate_mode flag for async " Yiannis Nikolakopoulos
2026-08-05 14:14   ` Huang, Ying
2026-07-30 15:02 ` [PATCH RFC v2 3/3] mm: use non-temporal stores for demotion Yiannis Nikolakopoulos
2026-07-30 17:30 ` [PATCH RFC v2 0/3] Demote to lower tier using non-temporal stores Gregory Price
2026-07-30 17:40   ` Frank van der Linden
2026-07-30 18:08     ` Johannes Weiner
2026-07-30 20:49       ` Gregory Price
2026-11-03 22:30 ` [RFC PATCH v3 0/3] mm: use non-temporal stores for demotion Huan Nguyen
2026-11-03 22:30   ` [RFC PATCH v3 1/3] mm, x86: support copying a folio using non-temporal stores Huan Nguyen
2026-11-04 22:31     ` sashiko-bot
2026-11-03 22:30   ` [RFC PATCH v3 2/3] mm/migrate: introduce async non-temporal migration mode Huan Nguyen
2026-11-04 22:31     ` sashiko-bot [this message]
2026-11-03 22:30   ` [RFC PATCH v3 3/3] mm/vmscan: demote folios using non-temporal stores Huan Nguyen
2026-11-04  0:09   ` [RFC PATCH v3 0/3] mm: use non-temporal stores for demotion Zi Yan
2026-11-04  9:07   ` Lorenzo Stoakes (ARM)

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-198231@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=alirad.malek@zptcorp.com \
    --cc=anna@kernel.org \
    --cc=apopple@nvidia.com \
    --cc=bharata@amd.com \
    --cc=bp@alien8.de \
    --cc=byungchul@sk.com \
    --cc=cel@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave@stgolabs.net \
    --cc=david@kernel.org \
    --cc=dimitrios.palyvos@zptcorp.com \
    --cc=fvdl@google.com \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=hpa@zytor.com \
    --cc=jackmanb@google.com \
    --cc=jic23@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=joshua.hahnjy@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=matthew.brost@intel.com \
    --cc=mhiramat@kernel.org \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=nhuhuan@google.com \
    --cc=nifan.cxl@gmail.com \
    --cc=rakie.kim@sk.com \
    --cc=rientjes@google.com \
    --cc=rkodsara@amd.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shivankg@amd.com \
    --cc=sj@kernel.org \
    --cc=surenb@google.com \
    --cc=tglx@kernel.org \
    --cc=trondmy@kernel.org \
    --cc=vbabka@kernel.org \
    --cc=weixugc@google.com \
    --cc=x86@kernel.org \
    --cc=xuezhengchu@huawei.com \
    --cc=yiannis.nikolakop@gmail.com \
    --cc=yiannis@zptcorp.com \
    --cc=ying.huang@linux.alibaba.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