英語
SMP IRQ 親和性¶
- 更新日誌
由 Ingo Molnar <mingo@redhat.com> 發起
由 Max Krasnyansky <maxk@qualcomm.com> 更新
/proc/irq/IRQ#/smp_affinity 和 /proc/irq/IRQ#/smp_affinity_list 指定允許給定 IRQ 源使用的目標 CPU。它是一個位掩碼 (smp_affinity) 或允許的 CPU 列表 (smp_affinity_list)。不允許關閉所有 CPU,如果 IRQ 控制器不支援 IRQ 親和性,則該值不會從所有 CPU 的預設值更改。
/proc/irq/default_smp_affinity 指定適用於所有非活動 IRQ 的預設親和性掩碼。一旦 IRQ 被分配/啟用,它的親和性位掩碼將被設定為預設掩碼。然後可以如上所述更改它。預設掩碼是 0xffffffff。
以下是將 IRQ44 (eth1) 限制為 CPU0-3,然後限制為 CPU4-7 的示例(這是一個 8-CPU SMP box)
[root@moon 44]# cd /proc/irq/44
[root@moon 44]# cat smp_affinity
ffffffff
[root@moon 44]# echo 0f > smp_affinity
[root@moon 44]# cat smp_affinity
0000000f
[root@moon 44]# ping -f h
PING hell (195.4.7.3): 56 data bytes
...
--- hell ping statistics ---
6029 packets transmitted, 6027 packets received, 0% packet loss
round-trip min/avg/max = 0.1/0.1/0.4 ms
[root@moon 44]# cat /proc/interrupts | grep 'CPU\|44:'
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7
44: 1068 1785 1785 1783 0 0 0 0 IO-APIC-level eth1
從上面的行可以看出,IRQ44 僅被傳遞到前四個處理器 (0-3)。現在讓我們將 IRQ 限制為 CPU(4-7)。
[root@moon 44]# echo f0 > smp_affinity
[root@moon 44]# cat smp_affinity
000000f0
[root@moon 44]# ping -f h
PING hell (195.4.7.3): 56 data bytes
..
--- hell ping statistics ---
2779 packets transmitted, 2777 packets received, 0% packet loss
round-trip min/avg/max = 0.1/0.5/585.4 ms
[root@moon 44]# cat /proc/interrupts | 'CPU\|44:'
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7
44: 1068 1785 1785 1783 1784 1069 1070 1069 IO-APIC-level eth1
這一次 IRQ44 僅被傳遞到最後四個處理器。即 CPU0-3 的計數器沒有改變。
以下是將相同 irq (44) 限制為 cpus 1024 到 1031 的示例
[root@moon 44]# echo 1024-1031 > smp_affinity_list
[root@moon 44]# cat smp_affinity_list
1024-1031
請注意,要使用位掩碼執行此操作,需要 32 個零的位掩碼才能遵循相關的位掩碼。