Re: [External Mail] [RFC PATCH] mm/mempolicy: Weighted interleave auto-tuning

Gregory Price
2024-12-22T16:55:02Z

On Sun, Dec 22, 2024 at 04:29:30PM +0800, Huang, Ying wrote:
> Gregory Price <gourry@gourry.net> writes:
>
> > On Sat, Dec 21, 2024 at 01:57:58PM +0800, Huang, Ying wrote:
>
> Another choice is that if the user set a value, he/she set all values
> effectively. Even if he/she doesn't set the other values, he/she thinks
> that the other values are good, and more importantly, the ratio is good.

This is probably the actual way to go.

> If so,
>
> default_values [5,2,-] <- 1 node not set, expected to be hotplugged
> user_values [4,2,0] <- user has only set one value, not populated nodes have value 0
> effective [4,2,0]
>
> hotplug event
> default_values [2,1,1] - reweight has occurred
> user_values [4,2,0]
> effective [4,2,0]
>
> In this way, 0 becomes a valid value too.
>
> What do you think about this?
>

We decided when implementing weights that 0 was a special value that
reverts to the system default:

Writing an empty string or `0` will reset the weight to the
system default. The system default may be set by the kernel
or drivers at boot or during hotplug events.

I'm ok pulling the default weights in collectively once the first one is
written, but 0 is an invalid value which causes issues.

We went through that when we initially implemented the feature w/ task-local
weights and why the help function overrides it to 1 if it's ever seen.

We'll revert back to our initial implementation w/ default_iw_table and
iw_table - where iw_table contains user-defined weights. Writing a 0 to
iw_table[N] will allow get_il_weight() to retrieve default_iw_table[N]
as the docs imply it should.

~Gregory