The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
To: Jiahui Zhang <jiahuitry@outlook.com>
Cc: SJ Park <sj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	damon@lists.linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Honggyu Kim <honggyu.kim@sk.com>
Subject: Re: [PATCH] mm/damon: prevent migration fallback to non-target nodes
Date: Wed,  8 Jul 2026 17:37:51 -0700	[thread overview]
Message-ID: <20260709003752.127954-1-sj@kernel.org> (raw)
In-Reply-To: <BY5PR02MB6642569E180FF82F147E7880B5FF2@BY5PR02MB6642.namprd02.prod.outlook.com>

+ Honggyu for origin intent of not adding __GFP_THISNODE

On Wed, 8 Jul 2026 10:55:05 -0700 Jiahui Zhang <jiahuitry@outlook.com> wrote:

> Hi SJ,
> 
> Thank you for the review.
> 
> On Wed, Jul 08, 2026 at 07:11:33AM -0700, SJ Park wrote:
> > So this patch is introducing a small behavioral change.  May I ask
> > why you think the new behavior is better?  Have you find some 
> > negative user impacts from the current behavior?
> 
> Consider a two-node tiered system, where node 0 is the fast tier and 
> node 1 is a CPU-less slow tier, such as CXL memory.  Suppose node 0 
> is nearly full and the user wants to promote hot regions (which reside
> on node 1) to node 0 with a command like:
> 
>   sudo damo start --ops vaddr --target_pid ${workload_pid} \
>       --damos_action migrate_hot 0 \
>       --damos_access_rate 70% max
> 
> Without the __GFP_THISNODE flag, when the memory allocator finds that
> node 0 is nearly full, it can fall back to node 1 without waking up 
> kswapd.

Have you considered or tested running demotion-purpose DAMOS scheme together?

> Then the pages allocated for migrate_pages() are still on node 1, 
> and the regions that are expected to be promoted to node 0 are only moved
>  to different physical pages on node 1.
> 
> As a result, the NUMA node placement does not change, but the following
> command still observes successful migrations:
> 
>   sudo bpftrace -e '
>   tracepoint:migrate:mm_migrate_pages /args->reason == 9/
>   {
>       @succeeded_pages = sum(args->succeeded);
>   }
>   interval:s:1
>   {
>       time("%H:%M:%S ");
>       print(@succeeded_pages);
>       clear(@succeeded_pages);
>   }'
> 
> I've also checked other page migration paths, such as alloc_demote_folio(),
>  alloc_misplaced_dst_folio() and do_move_pages_to_node(), all of which set
> the __GFP_THISNODE flag.
> 
> I am not sure whether the original design intended to provide only
> best-effort semantics,

To my understanding, it was initially trying to reflect what
demote_folio_list() does.  Because it doesn't have ___GFP_THISNODE, this
function also ended up not having it without a very serious reason.

My mental model of DAMOS_MIGRATE_{HOT,COLD} nowadays is like move_pages().
And I find do_move_pages_to_node(), which is used by move_pages() is also using
the flag.

So I think adding the flag is ok.  Cc-ed Honggyu for a case he has different
opinions, though.

> but I found this behavior very confusing in my
> experiment.

Thank you for sharing this pain point.

I agree this can be very confusing for inveestigations.  Not just confusing but
makes investigations of this case nearly impossible, iiuc.  DAMOS provides its
own stats for succeeded and failed operations, but that will again not be
helpful since migrate_pages would returned success in this case.

So, yes, let's add the flag unless someone else has a different opinions.

> 
> > We as the kernel community disallow [1] anonymous patch submissions.  Is zjh
> > your preferred identity?  Also, it is not a strict rule, but we as the mm
> > community prefer using a formal name if that's ok.
> 
> Sorry I did not notice this.  If you think the GFP flag should be added, I will
> send a v2 of the patch and correct the Signed-off-by issue.

Yes, please give others time to comment on (say, one day?) and proceed to v2 if
nobody disagrees to.

On the version, could you please add the clarification of the pain points you
encountered, and how this change made it disappeared?

Also, let's change the subject prefix from mm/damon: to mm/damon/ops-common:


Thanks,
SJ

[...]

  reply	other threads:[~2026-07-09  0:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08  8:07 [PATCH] mm/damon: prevent migration fallback to non-target nodes zjh
2026-07-08 14:11 ` SJ Park
2026-07-08 17:55   ` Jiahui Zhang
2026-07-09  0:37     ` SJ Park [this message]
2026-07-09  6:38       ` Jiahui Zhang

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=20260709003752.127954-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=honggyu.kim@sk.com \
    --cc=jiahuitry@outlook.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox