[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250621181127.36394-1-sj@kernel.org>
Date: Sat, 21 Jun 2025 11:11:27 -0700
From: SeongJae Park <sj@...nel.org>
To: SeongJae Park <sj@...nel.org>
Cc: Bijan Tabatabai <bijan311@...il.com>,
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 2/2] mm/damon/paddr: Allow multiple migrate targets
On Sat, 21 Jun 2025 11:02:15 -0700 SeongJae Park <sj@...nel.org> wrote:
[...]
> I'd hence suggest to implement and use a simple weights handling mechanism
> here. It could be roud-robin way, like weighted interleaving, or probabilistic
> way, using damon_rand().
>
> The round-robin way may be simpler in my opinion. For example,
>
> unsigned int damos_pa_nid_to_migrate(struct damos_migrate_dest *dest)
> {
> static unsigned int nr_migrated = 0;
> unsigned int total_weight = 0;
> unsigned int weights_to_ignore;
> size_t i;
>
> for (i = 0; i < dest->nr_dests; i++)
> total_weight += dest->weight_arr[i];
> weights_to_ignore = nr_migrate++ % total_weight;
Actually, probabilistic way may be not that complicated. Maybe we could to
below here.
return damon_rand(0, total_weight) >= weight_to_ignore;
> total_weight = 0;
> for (i = 0; i < dest->nr_dests; i++) {
> total_weight += dest->weight_arr[i];
> if (total_weight >= weights_to_ignore)
> return dest->node_id_arr[i];
> }
> WARN_ON_ONCE(1, "I don't know what I did wrong");
> return 0;
> }
But damon_rand() might be more expensive than the roud-robin way, and arguably
roud-robin way is what usrs who familiar with weighted interleaving may easily
expect and even prefer? I have no preferrence here.
Thanks,
SJ
[...]
Powered by blists - more mailing lists