All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH v3] mm/damon/ops-common: prevent migration fallback to non-target nodes
Date: Tue, 21 Jul 2026 14:07:16 +0000	[thread overview]
Message-ID: <20260721140716.C39B01F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260721135607.251869-1-sj@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] alloc_migration_target() overrides non-blocking gfp flags for large folios, causing kdamond to stall in synchronous direct reclaim.
--

--- Patch [1]: [PATCH v3] mm/damon/ops-common: prevent migration fallback to non-target nodes ---
commit 18e8e5ad17abc759ddf7302875cde768864ba912
Author: Jiahui Zhang <jiahuitry@outlook.com>

mm/damon/ops-common: prevent migration fallback to non-target nodes

This commit modifies DAMON's migration target allocation to use __GFP_THISNODE.
This prevents the allocator from silently falling back to other nodes when the
target node is full, which previously caused misleading migration statistics.

> diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
> index d7d7f100389b0..e59f77eca83b2 100644
> --- a/mm/damon/ops-common.c
> +++ b/mm/damon/ops-common.c
> @@ -312,7 +312,7 @@ static unsigned int __damon_migrate_folio_list(
>  		 * instead of migrated.
>  		 */
>  		.gfp_mask = (GFP_HIGHUSER_MOVABLE & ~__GFP_RECLAIM) |
> -			__GFP_NOMEMALLOC | GFP_NOWAIT,
> +			__GFP_NOMEMALLOC | GFP_NOWAIT | __GFP_THISNODE,

[Severity: High]
This is a pre-existing issue, but does adding __GFP_THISNODE here cause kdamond
to unexpectedly stall in synchronous direct reclaim when migrating large folios?

When migrate_pages() is called, it uses alloc_migration_target() in
mm/migrate.c. For large folios, alloc_migration_target() unconditionally
overrides the non-blocking GFP flags requested by DAMON:

mm/migrate.c:alloc_migration_target() {
	...
	if (folio_test_large(src)) {
		/*
		 * clear __GFP_RECLAIM to make the migration callback
		 * consistent with regular THP allocations.
		 */
		gfp_mask &= ~__GFP_RECLAIM;
		gfp_mask |= GFP_TRANSHUGE;
		order = folio_order(src);
	}
	...
}

Because GFP_TRANSHUGE includes __GFP_DIRECT_RECLAIM, the allocation can block.
Previously, without __GFP_THISNODE, the allocator could fall back to another
node. By enforcing __GFP_THISNODE on a full target node, this forced direct
reclaim will trigger, stalling the kdamond thread and preventing kswapd wakeups.

Could alloc_migration_target() be updated to respect the caller's intent to
not block?

>  		.nid = target_nid,
>  	};
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721135607.251869-1-sj@kernel.org?part=1

  reply	other threads:[~2026-07-21 14:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 13:56 [PATCH v3] mm/damon/ops-common: prevent migration fallback to non-target nodes SJ Park
2026-07-21 14:07 ` sashiko-bot [this message]
2026-07-21 14:18   ` SJ Park

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=20260721140716.C39B01F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sj@kernel.org \
    /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 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.