All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bijan Tabatabai <bijan311@gmail.com>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Bijan Tabatabai <bijan311@gmail.com>,
	SeongJae Park <sj@kernel.org>,
	damon@lists.linux.dev, Bijan Tabatabai <bijantabatab@micron.com>
Subject: Re: [PATCH] mm/damon/vaddr: avoid unnecessary migration between target nodes
Date: Mon,  4 Aug 2025 10:19:20 -0500	[thread overview]
Message-ID: <20250804151929.4613-1-bijan311@gmail.com> (raw)
In-Reply-To: <CAC5umyg8eje0C8i6KTQPUXgi8O8S3p1TsGe6-1VKr3vRJ=Ao7g@mail.gmail.com>

On Mon, 4 Aug 2025 21:46:49 +0900 Akinobu Mita <akinobu.mita@gmail.com> wrote:

> Hi,
> 
> 2025年8月4日(月) 3:01 SeongJae Park <sj@kernel.org>:
> >
> > Hello Akinobu,
> >
> > On Sun,  3 Aug 2025 22:00:28 +0900 Akinobu Mita <akinobu.mita@gmail.com> wrote:
> >
> > > This change avoids unnecessary migration by checking if the folio to which
> > > the migration is applied is already located in one of the target nodes.
> >
> > Each folio will get a single target node among the target nodes, based on the
> > weights of targets and the virtual address of the folio.  So skipping the
> > migration because the folio is on one of target nodes can result in wrong
> > behavior (not doing required migrations)?
> >
> > Also, a similar purpose optimization was already made by Bijan.  I guess you
> > aware of that and therefore Cc-ed Bijan.  Could you further share differences
> > between this and Bijan's one, and measured additional performance gain from
> > this patch, if you have?
> >
> > [1] https://lkml.kernel.org/r/20250725163300.4602-1-bijan311@gmail.com
> 
> In my current DAMON setup, the target nodes for migrate_hot action
> are 0-3, and for migrate_cold action, they are 4 and 5.
> 
> I'm looking for a way to prevent unnecessary movement between target
> nodes for each action, making interleaving an optional choice. For
> instance, I'd like to avoid migrations from node 4 to node 5 during a
> migrate_cold action.

Where a folio is placed is based on the virtual address of the folio and
the folio's offset from the start of the VMA it is in. So, as long as the
interleave weights and the folio's offset in the VMA are the same, folios
should not be migrated after being placed. This placement algorithm is the
same as the one used for mempolicy weighted interleaving.

It sounds like you are keeping the interleave weights constant, and I would
imagine that the virtual addresses the folios are mapped to are constant,
so I'm guessing the start address of some VMAs are changing. I don't think
I've seen the bahvior your describing in the workloads I've run, but I
guess it's possible if VMAs are being merged or broken up a lot, such as
through frequent mmaps/munmaps. Do you think something like this is
happening in your workload?

How often are the undesired migrations happening? Every time the scheme is
applied?
Also, would you be willing to share how you are configuring DAMON?

> I've observed a difference in behavior compared to Bijan's patch, and
> it seems there's a need for both approaches. Would it be possible to
> introduce a new option that allows us to specify whether interleaving
> is forced or optional, and then adjust the behavior based on that
> setting?

I wonder if this would be better handled as a paddr scheme. That way
you can configure the schemes such that only physical addresses in nodes
4-5 will migrate pages to nodes 0-3, and only physical address in nodes 0-3
will migrate to nodes 4-5.

Bijan

  reply	other threads:[~2025-08-04 15:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-03 13:00 [PATCH] mm/damon/vaddr: avoid unnecessary migration between target nodes Akinobu Mita
2025-08-03 18:01 ` SeongJae Park
2025-08-04 12:46   ` Akinobu Mita
2025-08-04 15:19     ` Bijan Tabatabai [this message]
2025-08-04 16:43       ` SeongJae Park
2025-08-05 16:04         ` Akinobu Mita
2025-08-05 17:51           ` SeongJae 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=20250804151929.4613-1-bijan311@gmail.com \
    --to=bijan311@gmail.com \
    --cc=akinobu.mita@gmail.com \
    --cc=bijantabatab@micron.com \
    --cc=damon@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.