Re: [PATCH v5 01/11] mm/mempolicy: implement the sysfs-based weighted_interleave interface

From: Gregory Price
Date: Tue Jan 02 2024 - 22:00:10 EST


On Wed, Jan 03, 2024 at 10:45:53AM +0800, Huang, Ying wrote:
>
> > The minimum functionality is everything receiving a default weight of 1,
> > such that weighted interleave's behavior defaults to round-robin
> > interleave. This gets the system off the ground.
>
> I don't think that we need to implement all functionalities now. But,
> we may need to consider more especially if it may impact the user space
> interface. The default base weight is something like that. If we
> change the default base weight from "1" to "16" later, users may be
> surprised. So, I think it's better to discuss it now.
>

This is a hill I don't particularly care to die on. I think the weights
are likely to end up being set at boot and rebalanced as (rare) hotplug
events occur.

So if people think the default weight should be 3,16,24 or 123, i don't
think it's going to matter.

>
> We can use a wrapper function to hide the logic.
>

Done. I'll push a new set tomorrow.

> > I think it also allows MPOL_F_GWEIGHT to be eliminated.
>
> Do we need a way to distinguish whether to copy the global weights to
> local weights when the memory policy is created? That is, when the
> global weights are changed later, will the changes be used? One
> possible solution is
>
> - If no weights are specified in set_mempolicy2(), the global weights
> will be used always.
>
> - If at least one weight is specified in set_mempolicy2(), it will be
> used, and the other weights in global weights will be copied to the
> local weights. That is, changes to the global weights will not be
> used.
>

What's confusing about that is that if a user sets a weight to 0,
they'll get a non-0 weight - always.

In my opinion, if we want to make '0' mean 'use system default', then
it should mean 'ALWAYS use system default for this node'.

"Use the system default at the time the syscall was called, and do not
update to use a new system default if that default is changed" is
confusing.

If you say use a global value, use the global value. Simple.

> --
> Best Regards,
> Huang, Ying