Re: [PATCH] cgroup/cpuset: Add a new isolated mems.policy type.

From: Tejun Heo
Date: Sun Sep 04 2022 - 15:42:23 EST


Hello,

On Fri, Sep 02, 2022 at 02:33:03PM +0800, hezhongkun wrote:
> From: Zhongkun He <hezhongkun.hzk@xxxxxxxxxxxxx>
>
> Mempolicy is difficult to use because it is set in-process
> via a system call. We want to make it easier to use mempolicy
> in cpuset, and we can control low-priority cgroups to
> allocate memory in specified nodes. So this patch want to
> adds the mempolicy interface in cpuset.
>
> The mempolicy priority of cpuset is lower than the task.
> The order of getting the policy is:
> 1) vma mempolicy
> 2) task->mempolicy
> 3) cpuset->mempolicy
> 4) default policy.
>
> cpuset's policy is owned by itself, but descendants will
> get the default mempolicy from parent.
>
> How to use the mempolicy interface:
> echo prefer:2 > /sys/fs/cgroup/zz/cpuset.mems.policy
> echo bind:1-3 > /sys/fs/cgroup/zz/cpuset.mems.policy
> echo interleave:0,1,2,3 >/sys/fs/cgroup/zz/cpuset.mems.policy
> Show the policy:
> cat /sys/fs/cgroup/zz/cpuset.mems.policy
> prefer:2
> cat /sys/fs/cgroup/zz/cpuset.mems.policy
> bind:1-3
> cat /sys/fs/cgroup/zz/cpuset.mems.policy
> interleave:0-3
> Clear the policy:
> echo default > /sys/fs/cgroup/zz/cpuset.mems.policy

So, I'm a fan of adding cgroup functionalities which don't enforce anything
resource related. What you're proposing can easily be achieved with userland
tooling, right?

Thanks.

--
tejun