Re: [PATCH v4 00/11] mempolicy2, mbind2, and weighted interleave
From: Huang, Ying <hidden>
Date: 2024-01-02 04:11:05
Also in:
linux-doc, linux-fsdevel, linux-mm, lkml
Gregory Price [off-list ref] writes:
On Wed, Dec 20, 2023 at 10:27:06AM +0800, Huang, Ying wrote:quoted
Gregory Price [off-list ref] writes:quoted
Assuming we remove policy_node altogether... do we still break up the set/get interface into separate structures to avoid this in the future?I have no much experience at ABI definition. So, I want to get guidance from more experienced people on this. Is it good to implement all functionality of get_mempolicy() with get_mempolicy2(), so we can deprecate get_mempolicy() and remove it finally? So, users don't need to use 2 similar syscalls? And, IIUC, we will not get policy_node, addr_node, and policy config at the same time, is it better to use a union instead of struct in get_mempolicy2()?We discussed using flags to change the operation of mempolicy earlier and it was expressed that multiplexing syscalls via flags is no longer a preferred design because it increases complexity in the long term.
In general, I agree with that. "ioctl" isn't the best pattern to define syscall.
The mems_allowed extension to get_mempolicy() is basically this kind of multiplexing. So ultimately I think it better to simply remove that functionality from get_mempolicy2(). Further: it's not even technically *part* of mempolicy, it's part of cpusets, and is accessible via sysfs through some combination of cpuset.mems and cpuset.mems.effective. So the mems_allowed part of get_mempolicy() has already been deprecated in that way. Doesn't seem worth it to add it to mempolicy2. The `policy_node` is more of a question as to whether it's even useful. Right now it only applies to interleave policies... but it's also insanely racey. The moment you pluck the next interleave target, it's liable to change. I don't know how anyone would even use this.
Both sounds reasonable for me. How about add this into the patch description? This will help anyone who want to know why the syscall is defined this way.
If we drop it, we can alway add it back in with an extension if someone actually has a use-case for it and we decide to fully deprecate get_mempolicy() (which seems unlikely, btw).
I still think it's possible, after decades.
In either case, the extension I made allows get_mempolicy() to be used to fetch policy_node via the original method, for new policies, so that would cover it if anyone is actually using it.
-- Best Regards, Huang, Ying