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

From: Zhongkun He
Date: Mon Sep 05 2022 - 06:30:58 EST


Hi Tejun, thanks for your reply.

We usually use numactl to set the memory policy, but it cannot be changed dynamically. In addition, the mempolicy of cpuset can provide a more convenient interface for management and control panel.

Sorry,I don't quite understand the meaning of "don't enforce anything resource related". Does it mean mempolicy, such as "prefer:2" must specify node? Or "cpuset.mems.policy" need to specify a default value?
(cpuset.mems.policy does not require a default value.)

Thanks.


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.