Re: [PATCH v5 01/11] mm/mempolicy: implement the sysfs-based weighted_interleave interface
From: Huang, Ying <hidden>
Date: 2024-01-03 06:05:14
Also in:
linux-doc, linux-fsdevel, linux-mm, lkml
Gregory Price [off-list ref] writes:
On Wed, Jan 03, 2024 at 10:45:53AM +0800, Huang, Ying wrote:quoted
quoted
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.quoted
We can use a wrapper function to hide the logic.Done. I'll push a new set tomorrow.quoted
quoted
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.
I mainly have concerns about consistency. The global weights can be changed while the local weights are fixed. For example, - Weights of node 0,1 is [3, 1] initially - Process A call set_mempolicy2() to set weights to [4, 0], that is, use default weight for node 1. - After hotplug, the weights of node is changed to [12, 4, 1], now the effective weights used in process A becomes [4, 4]. Which is hardly desired. Another choice is to disallow "0" as weight in set_mempolicy2(). -- Best Regards, Huang, Ying