Ubuntu 22.04 LTS做CPU亲和性设置的方法

CPU/显卡/打印机/USB设备等硬件问题
回复
jacky_chenlong7789
帖子: 6
注册时间: 2022-05-13 10:42
系统: windows10
送出感谢: 0
接收感谢: 0

Ubuntu 22.04 LTS做CPU亲和性设置的方法

#1

帖子 jacky_chenlong7789 » 2022-05-13 15:16

Hi All,

其中在Ubuntu 20.04 LTS的/sys/fs/cgroup/cpuset创建目录 tailor tinker,会有生成有: tasks、cpuset.cpus 、cpuset.mems 文件,
但是在Ubuntu 22.04 LTS的/sys/fs/cgroup/cpuset创建目录 tailor tinker,不会有生成有: tasks、cpuset.cpus 、cpuset.mems 文件。
因此在Ubuntu 20.04 LTS能做cpuset的配置CPU亲和性,但是在Ubuntu 22.04 LTS中就不能。
请问下,有没有在Ubuntu 22.04 LTS做CPU亲和性设置的方法。谢谢!

Ubuntu 22.04 LTS setting cpuset
root@ubuntu:/sys/fs/cgroup/cpuset# mkdir tailor tinker
root@ubuntu:/sys/fs/cgroup/cpuset#ls tailor
cgroup.controllers cgroup.kill cgroup.procs cgroup.threads cpu.stat
cgroup.events cgroup.max.depth cgroup.stat cgroup.type io.pressure
cgroup.freeze cgroup.max.descendants cgroup.subtree_control cpu.pressure memory.pressure

Why Create directory /sys/fs/cgroup/cpuset/tailor in 22.04 no files:cpuset.cpus、tasks、cpuset.mems ?But there are these files in 20.04 LST.

Ubuntu 20.04 LTS server setting cpuset:
root@ub20:/sys/fs/cgroup/cpuset# mkdir tailor tinker
root@ub20:/sys/fs/cgroup/cpuset# cd tailor/
root@ub20:/sys/fs/cgroup/cpuset/tailor# ls
cgroup.clone_children cpuset.effective_cpus cpuset.memory_migrate cpuset.mems tasks
cgroup.procs cpuset.effective_mems cpuset.memory_pressure cpuset.sched_load_balance
cpuset.cpu_exclusive cpuset.mem_exclusive cpuset.memory_spread_page cpuset.sched_relax_domain_level
cpuset.cpus cpuset.mem_hardwall cpuset.memory_spread_slab notify_on_release
头像
astolia
论坛版主
帖子: 5677
注册时间: 2008-09-18 13:11
送出感谢: 1 次
接收感谢: 974 次

Re: Ubuntu 22.04 LTS做CPU亲和性设置的方法

#2

帖子 astolia » 2022-05-13 18:16

遇事不决查文档 https://www.kernel.org/doc/html/latest/ ... usets.html
To start a new job that is to be contained within a cpuset, the steps are:
1. mkdir /sys/fs/cgroup/cpuset
2. mount -t cgroup -ocpuset cpuset /sys/fs/cgroup/cpuset
3. Create the new cpuset by doing mkdir’s and write’s (or echo’s) in the /sys/fs/cgroup/cpuset virtual file system.
4. Start a task that will be the “founding father” of the new job.
5. Attach that task to the new cpuset by writing its pid to the /sys/fs/cgroup/cpuset tasks file for that cpuset.
6. fork, exec or clone the job tasks from this founding father task.
回复