[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250620202155.98021-1-sj@kernel.org>
Date: Fri, 20 Jun 2025 13:21:55 -0700
From: SeongJae Park <sj@...nel.org>
To: Bijan Tabatabai <bijan311@...il.com>
Cc: SeongJae Park <sj@...nel.org>,
damon@...ts.linux.dev,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org,
david@...hat.com,
ziy@...dia.com,
matthew.brost@...el.com,
joshua.hahnjy@...il.com,
rakie.kim@...com,
byungchul@...com,
gourry@...rry.net,
ying.huang@...ux.alibaba.com,
apopple@...dia.com,
bijantabatab@...ron.com,
venkataravis@...ron.com,
emirakhur@...ron.com,
ajayjoshi@...ron.com,
vtavarespetr@...ron.com
Subject: Re: [RFC PATCH v2 0/2] mm/damon/paddr: Allow interleaving in migrate_{hot,cold} actions
Hi Bijan,
On Fri, 20 Jun 2025 13:04:56 -0500 Bijan Tabatabai <bijan311@...il.com> wrote:
[...]
> This patch set adds the mechanism for dynamically changing how application
> data is interleaved across nodes while leaving the policy of what the
> interleave weights should be to userspace. It does this by modifying the
> migrate_{hot,cold} DAMOS actions to allow passing in a list of migration
> targets to their target_nid parameter. When this is done, the
> migrate_{hot,cold} actions will migrate pages between the specified nodes
> using the global interleave weights found at
> /sys/kernel/mm/mempolicy/weighted_interleave/node<N>. This functionality
> can be used to dynamically adjust how pages are interleaved by changing the
> global weights. When only a single migration target is passed to
> target_nid, the migrate_{hot,cold} actions will act the same as before.
This means users are required to manipulate two interfaces. DAMON sysfs for
target nodes, and weighted_interleave sysfs for weights. I don't think this
coupling is very ideal.
Off the opt of my head, I concern if users could mistakenly forget updating one
of those, since the requirement is not very clear. I think the interface
should clearly explain that. For example, writing a special keywords, say,
"use_interleave_weights" to target_nid parameter sysfs file. But, even in the
case, users who update weighted_interleave might foget updating target nodes on
DAMON interface.
I think letting DAMOS_MIGRATE_{HOT,COLD} to use all nodes as migration target
when the special keyword is given is one of better options. This is what I
suggested to the previous version of this patch series. But now I think it
would be better if we could just remove this coupling.
I understand a sort of this coupling is inevitable if the kernel should make
the connection between DAMON and weighted interleaving itself, without
user-space help. But now I think we could get user-space help, according to
below. Please keep reading.
[...]
> As a toy example, imagine some application that uses 75% of the local
> bandwidth. Assuming sufficient capacity, when running alone, we want to
> keep that application's data in local memory. However, if a second
> instance of that application begins, using the same amount of bandwidth,
> it would be best to interleave the data of both processes to alleviate the
> bandwidth pressure from the local node. Likewise, when one of the processes
> ends, the data should be moves back to local memory.
>
> We imagine there would be a userspace application that would monitor system
> performance characteristics, such as bandwidth utilization or memory access
> latency, and uses that information to tune the interleave weights. Others
> seem to have come to a similar conclusion in previous discussions [3].
> We are currently working on a userspace program that does this, but it is
> not quite ready to be published yet.
So, at least in this toy example, we have user-space control. Then, I think we
could decouple DAMON and weighted interleaving, and ask the usr-space tool to
be the connection between those. That is, extend DAMOS_MIGRATE_{HOT,COLD} to
let users specify migration target nodes and their weights. And ask the
user-space tool to periodically read weighted interleaving parameters that
could be auto-tuned, and update DAMOS_MIGRATE_{HOT,COLD} parameters
accordingly. Actually the user-space tool on this example is making the
weights by itself, so this should be easy work to do?
Also, even for general use case, I think such user-space intervention is not
too much request. Please let me know if I'm wrong.
>
> We believe DAMON is the correct venue for the interleaving mechanism for a
> few reasons. First, we noticed that we don't ahve to migrate all of the
> application's pages to improve performance. we just need to migrate the
> frequently accessed pages. DAMON's existing hotness traching is very useful
> for this. Second, DAMON's quota system can be used to ensure we are not
> using too much bandwidth for migrations. Finally, as Ying pointed out [4],
> a complete solution must also handle when a memory node is at capacity. The
> existing migrate_cold action can be used in conjunction with the
> functionality added in this patch set to provide that complete solution.
These make perfect sense to me. Thank you for adding this great summary.
>
> Functionality Test
> ==================
[...]
> Performance Test
> ================
[...]
> Updating the interleave weights, and having DAMON migrate the workload
> data according to the weights resulted in an approximately 25% speedup.
Awesome. Thank you for conducting this great tests and sharing the results!
>
> Questions for Reviewers
> =======================
> 1. Are you happy with the changes to the DAMON sysfs interface?
I'm happy with it for RFC level implementation. And in my opinion, you now
proved this is a good idea. For next steps toward mainline landing, I'd like
to suggest below interface change.
Let's allow users specify DAMOS_MIGRATE_{HOT,COLD} target nodes and weights
using only DAMON interface. And let the user-space tool do the synchronization
with weighted interleaving or other required works.
This may require writing not small amount of code, especially for DAMON sysfs
interface. I think it is doable, though. If you don't mind, I'd like to
quickly make a prototype and share with you.
What do you think?
> 2. Setting an interleave weight to 0 is currently not allowed. This makes
> sense when the weights are only used for allocation. Does it make sense
> to allow 0 weights now?
I have no opinion, and would like to let mempolicy folks make voices. But if
we go on the decoupling approach as I suggested above, we can do this
discussion in a separate thread :)
[...]
> Revision History
> ================
> Changes from v1
> (https://lore.kernel.org/linux-mm/20250612181330.31236-1-bijan311@gmail.com/)
> - Reuse migrate_{hot,cold} actions instead of creating a new action
> - Remove vaddr implementation
> - Remove most of the use of mempolicy, instead duplicate the interleave
> logic and access interleave weights directly
> - Write more about the use case in the cover letter
> - Write about why DAMON was used for this in the cover letter
> - Add correctness test to the cover letter
> - Add performance test
Again, thank you for revisioning. Please bear in mind with me at next steps.
I believe this work is very promising.
Thanks,
SJ
[...]
Powered by blists - more mailing lists