为Linux内核设置cpu亲和力,而不是进程 [英] setting cpu affinity for linux kernel, not process
问题描述
我很难找到有关如何设置linux内核(及其所有已加载模块)的cpu亲和力的信息,而不是特定过程的信息.
I am having a hard time finding information about how to set cpu affinity for linux kernel (with all of its loaded modules), NOT for a specific process.
这是因为我希望内核一直在CPU 0上运行以处理I/O内容,并且不希望任何开关在其他3个CPU上运行,因为它可能会污染L1和L2缓存.
This is because I want the kernel to run on CPU 0 all the time to handle I/O stuff, and not do any switches to run on other 3 CPUs because it may pollute L1 and L2 caches.
谢谢.
Nulik
推荐答案
代表进程的内核工作将始终在发出请求的CPU上进行.不过,您可以引导中断.查看/proc/interrupts
以确定要移动的中断(例如与eth0
匹配的所有内容),并通过将十六进制掩码回显到/proc/irq/XXX/smp_affinity
来设置亲和力.
Kernel work on behalf of processes will always happen on the CPU that makes the request. You can steer interrupts, though. Look at /proc/interrupts
to identify the interrupts you want to move (say everything matching eth0
) and set the affinity by echoing a hexadecimal mask to /proc/irq/XXX/smp_affinity
.
这篇关于为Linux内核设置cpu亲和力,而不是进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!