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

Gregory Price
2024-12-21T14:58:12Z

On Sat, Dec 21, 2024 at 01:57:58PM +0800, Huang, Ying wrote:
> Hi, Joshua,
>
> Joshua Hahn <joshua.hahnjy@gmail.com> writes:
>
> > On Fri, 13 Dec 2024 15:19:20 +0900 Hyeonggon Yoo <hyeonggon.yoo@sk.com> wrote:
> >
> >> On 2024-12-11 06:54 AM, Joshua Hahn wrote:
>
> [snip]
>
> >
> > [-----8<-----]
> >
> >> > +What: /sys/kernel/mm/mempolicy/weighted_interleave/max_node_weight
>
> I don't think that we need a new knob for this. Just use a reasonable
> default value, for example, 32 or 16. If it turns out that a knob will
> be really helpful, we can add it at that time. For now, I don't think
> the requirements are clear. And, this is a new ABI and we need to
> maintain it almost for ever. We must be careful about new knob.
>

This is fair. We spent a good amount of time modeling the best
effective maximum weight and basically came to the conclusion that 32
has a good balance of minimizing error and being somewhat aggressive.

Ripping out the sysfs is easy enough.

> >
> > Regardless of what implementation makes sense, I can re-write the
> > description so that there is no ambiguity when it comes to the
> > expected behavior of the code. Thank you for pointing this out!
>
> I don't think that it's a good idea to override the user supplied
> configuration values. User configurations always have higher priority
> than system default configurations. IIUC, this is the general rule of
> Linux kernel user space interface.
>

We discussed this and decided it was confusing no matter what we did.

If new data comes in (CDAT data from a hotplug event), then the weights
are now wrong for the new global state - regardless of whether the user
set a weight manually or not. This also allowed us to simplify the
implementation a bit.

But if generally we need to preserve user settings, then I think the
best we can do to provide a sane system is ignore the user setting when
re-weighting on a hotplug event.

e.g. user has not set a value

default_values [5,2,-] <- 1 node not set, expected to be hotplugged
user_values [-,-,-] <- user has not set values
effective [5,2,-]

hotplug event
default_values [2,1,1] - reweight has occurred
user_values [-,-,-]
effective [2,1,1]

e.g. user has set a value

default_values [5,2,-] <- 1 node not set, expected to be hotplugged
user_values [4,-,-] <- user has only set one value
effective [4,2,-]

hotplug event
default_values [2,1,1] - reweight has occurred
user_values [4,-,-]
effective [4,1,1]

So default values get updated, but user values get left alone.

If that's sane we'll fix it up.

> ---
> Best Regards,
> Huang, Ying