如何设置对内核线程的亲和力? [英] How one can set affinity for kernel threads?
本文介绍了如何设置对内核线程的亲和力?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Linux内核上, 3.11.0-13-generic
,我无法为内核线程设置相似性,如以下示例所示:
On a Linux kernel 3.11.0-13-generic
i can't set affinity for kernel threads as in the following example:
>ps -p 828
PID TTY TIME CMD
828 ? 00:00:00 nfsiod
>sudo taskset -pc 7 828
pid 828's current affinity list: 0-11
taskset: failed to set pid 828's affinity: Invalid argument
>sudo taskset -pc 7 17551
pid 17551's current affinity list: 7
pid 17551's new affinity list: 7
>
17551是用户进程,nfsiod是内核线程.如何更改对作为内核线程运行的nfsiod守护进程的亲和力?
17551 is a user process, and nfsiod is a kernel thread. How can I change the affinity for the nfsiod deamon running as a kernel thread ?
推荐答案
许多内核线程将标志设置为 PF_NO_SETAFFINITY
:
Many kernel threads set the flag PF_NO_SETAFFINITY
:
#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */
要更改亲和力,您必须更改内核.
To change the affinity, you would have to change the kernel.
这篇关于如何设置对内核线程的亲和力?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文