我查看了 Linux 服务器调优文档,其中提到安装 irqbalance (http://www.irqbalance.org/) 在 SMP 系统上。我现在在四核系统上查看它,虽然“ps axf”可以告诉我它正在运行,但我没有看到任何统计数据或任何类型的信息,表明它是否/如何影响系统。
有人知道去哪儿看吗?
答案1
在源代码中他们多次引用 /proc。也许你可以在那里找到答案。root@[/usr/local/src/irqbalance-0.55]egrep -ri "proc|sys" *
activate.c: sprintf(buf, "/proc/irq/%i/smp_affinity", irq->number);
cpumask.h: * set of CPU's in a system, one bit position per CPU number.
cpumask.h: * The following particular system cpumasks and operations manage
cpumask.h: * be plugged in at anytime during the life of that system boot.
cpumask.h:int highest_possible_processor_id(void);
cputree.c: * This file contains the code to construct and manipulate a hierarchy of processors,
cputree.c: * cache domains and processor cores.
cputree.c:#include <sys/types.h>
cputree.c: dir = opendir("/sys/devices/system/cpu");
cputree.c: sprintf(new_path, "/sys/devices/system/cpu/%s", entry->d_name);
irqbalance.c:#include <sys/time.h>
irqbalance.c: /* On single core UP systems irqbalance obviously has no work to do */
irqbalance.c: /* On dual core/hyperthreading shared cache systems just do a one shot setup */
irqbalance.c: parse_proc_interrupts();
irqbalance.c: parse_proc_interrupts();
irqbalance.c: parse_proc_interrupts();
irqbalance.c: /* cope with cpu hotplug -- detected during /proc/interrupts parsing */
irqbalance.h:extern void parse_proc_interrupts(void);
irqlist.c:#include <sys/types.h>
irqlist.c: * This function classifies and reads various things from /proc about a specific irq
irqlist.c: sprintf(buf, "/proc/irq/%i", number);
irqlist.c: sprintf(buf, "/proc/irq/%i/smp_affinity", number);
Makefile:LIBS=bitmap.o irqbalance.o cputree.o procinterrupts.o irqlist.o placement.o activate.o network.o powermode.o numa.o classify.o
network.c:#include <sys/ioctl.h>
network.c: sprintf(buffer,"/sys/bus/pci/devices/%s/irq", driver.bus_info);
network.c: file = fopen("/proc/net/dev", "r");
numa.c:#include <sys/types.h>
numa.c: dir = opendir("/sys/bus/pci/devices");
numa.c: sprintf(line,"/sys/bus/pci/devices/%s/irq", entry->d_name);
numa.c: sprintf(line,"/sys/bus/pci/devices/%s/class", entry->d_name);
numa.c: sprintf(line,"/sys/bus/pci/devices/%s/local_cpus", entry->d_name);
numa.c: * Ethernet gets the type via /proc/net/dev; in addition down'd interfaces
powermode.c: file = fopen("/proc/stat", "r");
powermode.c: dummy = strtoull(c, &c, 10); /* system */
procinterrupts.c:void parse_proc_interrupts(void)
procinterrupts.c: file = fopen("/proc/interrupts", "r");
答案2
根据 evildeed 的回答,运行sudo cat /proc/irq/*/smp_affinity
应该会告诉你。如果你得到一个以上的答案,它应该是有效的。
由于输出是位掩码的整数变换,因此非程序员可能很难理解。
例如:
- 绑定到 cpu0 - 1
- 绑定到 cpu1 - 2
- 绑定到 cpu0 和/或 cpu1 - 3
- 绑定到 cpu3,4,7 - 282
答案3
您可以通过执行 cat /proc/interrupts 来大致了解它是否正在执行任何操作,并查看您尝试隔离的进程是否正在在应该运行高优先级进程的处理器上创建中断。