免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 47717 | 回复: 89
打印 上一主题 下一主题

关于LINUX上中断在各个CPU之间的负载平衡问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-06-29 11:04 |只看该作者 |倒序浏览
关于LINUX上中断在各个CPU之间的负载平衡问题

看帖子
http://linux.chinaunix.net/bbs/thread-753474-1-1.html

说4个CPU有严重的不平衡问题。因为无条件实验,
LZ也不在回贴。所以请有兴趣的来参加实验和讨论。

论坛徽章:
0
2 [报告]
发表于 2007-06-29 11:10 |只看该作者
kernel启动参数加上acpi_irq_balance会不会好? 我试验下先,默认是不balance

论坛徽章:
0
3 [报告]
发表于 2007-06-29 11:19 |只看该作者
好。我想应该问题在于KERNEL而不是NAT(iptables). 所以发这里了

论坛徽章:
0
4 [报告]
发表于 2007-06-29 11:24 |只看该作者
原帖由 思一克 于 2007-6-29 11:19 发表于 3楼  
好。我想应该问题在于KERNEL而不是NAT(iptables). 所以发这里了


没用。

[root@localhost 21]# cat /proc/cmdline
ro root=LABEL=/ vga=0x31B acpi_irq_balance

[root@localhost 21]# grep eth0 /proc/interrupts
21:      19341          0   IO-APIC-fasteoi   libata, eth0

eth0和libata中断还是全送到了CPU 0, CPU 1一个也没收到。  我机器上是Pentium D双核CPU。



[root@localhost 21]# cat /proc/irq/21/smp_affinity
00000003
这个值是我写入的, 两颗cpu的bitmap位都被置1以允许21号中断, 但还是只送到cpu 0

论坛徽章:
0
5 [报告]
发表于 2007-06-29 11:27 |只看该作者
你cat /proc/interrupts的结果是什么?

论坛徽章:
0
6 [报告]
发表于 2007-06-29 11:35 |只看该作者
原帖由 思一克 于 2007-6-29 11:27 发表于 5楼  
你cat /proc/interrupts的结果是什么?


[root@localhost Documentation]# cat /proc/interrupts
           CPU0       CPU1
  0:        358          0   IO-APIC-edge      timer
  1:          2          0   IO-APIC-edge      i8042
  8:       8099          0   IO-APIC-edge      rtc
  9:          0          0   IO-APIC-fasteoi   acpi
12:          4          0   IO-APIC-edge      i8042
14:         33          0   IO-APIC-edge      ide0
16:      88855          0   IO-APIC-fasteoi   HDA Intel, fglrx
17:      22918          0   IO-APIC-fasteoi   uhci_hcd:usb1, ehci_hcd:usb5
18:          0          0   IO-APIC-fasteoi   uhci_hcd:usb2
19:          0          0   IO-APIC-fasteoi   uhci_hcd:usb3, Ensoniq AudioPCI
20:          0          0   IO-APIC-fasteoi   uhci_hcd:usb4
21:      32170          0   IO-APIC-fasteoi   libata, eth0
NMI:          0          0
LOC:     234999     203989
ERR:          0
MIS:          0



贫富悬殊很严重啊

论坛徽章:
0
7 [报告]
发表于 2007-06-29 11:38 |只看该作者
原帖由 思一克 于 2007-6-29 11:04 发表于 1楼  
关于LINUX上中断在各个CPU之间的负载平衡问题

看帖子
http://linux.chinaunix.net/bbs/thread-753474-1-1.html

说4个CPU有严重的不平衡问题。因为无条件实验,
LZ也不在回贴。所以请有兴趣的来参加实验 ...

??我觉得是正常的啊,linux默认是将网卡给一个cpu的own的啊,所以你所有的网卡中断都会发给那个CPU。
要改也很容易的,只要修改APIC的RT表就行了。我不太清楚linux提供的接口函数是什么,但apic.c文件或许展现出一些线索。

论坛徽章:
0
8 [报告]
发表于 2007-06-29 11:39 |只看该作者
Documentation/IRQ-affinity.txt

SMP IRQ affinity, started by Ingo Molnar <mingo@redhat.com>


/proc/irq/IRQ#/smp_affinity specifies which target CPUs are permitted
for a given IRQ source. It's a bitmask of allowed CPUs. It's not allowed
to turn off all CPUs, and if an IRQ controller does not support IRQ
affinity then the value will not change from the default 0xffffffff.

Here is an example of restricting IRQ44 (eth1) to CPU0-3 then restricting
the IRQ to CPU4-7 (this is an 8-CPU SMP box):

[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 44:
44:          0       1785       1785       1783       1783          1
1          0   IO-APIC-level  eth1
[root@moon 44]# echo f0 > smp_affinity
[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 | grep 44:
44:       1068       1785       1785       1784       1784       1069       1070       1069   IO-APIC-level  eth1
[root@moon 44]#



他说的这种情况在我机器上完全无效, 无论如何设置smp_affinity, 还是都送到了cpu 0

论坛徽章:
0
9 [报告]
发表于 2007-06-29 11:42 |只看该作者
原帖由 zx_wing 于 2007-6-29 11:38 发表于 7楼  

只要修改APIC的RT表就行了



是ioapic的irq route table吧?  看了/proc下没有, /sys/devices/system/下有ioapic、lapic和irqrouter目录, 但进去只有空目录

猜测改写/proc/irq/<number>/smp_affinity文件,就是影响ioapic的RT表的──但不知为何,我机器上不好使

[ 本帖最后由 albcamus 于 2007-6-29 11:46 编辑 ]

论坛徽章:
0
10 [报告]
发表于 2007-06-29 11:49 |只看该作者
原帖由 albcamus 于 2007-6-29 11:42 发表于 9楼  



是ioapic的irq route table吧?  看了/proc下没有, /sys/devices/system/下有ioapic、lapic和irqrouter目录, 但进去只有空目录

猜测改写/proc/irq/<number>/smp_affinity文件,就是影响ioapic ...

是这个表。我不清楚在linux下有什么接口可以改它,但既然在/sys有,那就应该有相应的driver。
不太清楚linux里这部分,只能提供一点线索
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP