更改中断 smp_affinity

更改中断 smp_affinity

如下所示,nvidia 正在共享中断,并且该中断仅使用 CPU0,我如何更改 nvidia 的中断,以及如何使其使用两个 CPU?
这里是一篇描述第二个问题的文章,我可以通过修改 smp_affinity 在 CPU0 和 CPU1 之间进行更改,但不明白如何将其设置为使用两个 CPU。

根据博客将 smp_affinity 设置为 3 应该同时使用 CPU0 和 CPU1。实际上,在我的例子中,它使用 CPU0(表现得就像它被设置为 1)。将其设置为 2 使用 CPU1。

radu@radu-work:~$ cat /proc/interrupts
           CPU0       CPU1       
  0:         79          0   IO-APIC-edge      timer
  1:          9      17152   IO-APIC-edge      i8042
  4:          2          0   IO-APIC-edge    
  6:          5          0   IO-APIC-edge      floppy
  7:          0          0   IO-APIC-edge      parport0
  8:          1          0   IO-APIC-edge      rtc0
  9:          0          0   IO-APIC-fasteoi   acpi
 12:     694613          0   IO-APIC-edge      i8042
 16:    1233922          0   IO-APIC-fasteoi   uhci_hcd:usb3, ahci, nvidia
 17:       3961     168757   IO-APIC-fasteoi   uhci_hcd:usb4, pata_jmicron
 18:          0          0   IO-APIC-fasteoi   ehci_hcd:usb1, uhci_hcd:usb7
 19:         59          0   IO-APIC-fasteoi   ata_piix, ata_piix, uhci_hcd:usb6
 22:        819       6915   IO-APIC-fasteoi   HDA Intel
 23:          2          0   IO-APIC-fasteoi   ehci_hcd:usb2, uhci_hcd:usb5, eth


radu@radu-work:~$ sudo cat /proc/irq/16/smp_affinity 
1

root@radu-work:~# uname -a
Linux radu-work 2.6.32-32-generic #62-Ubuntu SMP Wed Apr 20 21:54:21 UTC 2011 i686 GNU/Linux

谢谢。

编辑: 我正在尝试让我的 Linux 盒子播放高清电影(至少 720)。我有一个 nvidia 66xx 系列,Linux 版本 Ubuntu 11.04,我安装了 nvidia 专有驱动程序,但它们不支持旧硬件(仅 8xxx 系列及以上)的硬件加速(和视频解码),因此解码是在软件中完成的。当我尝试观看高清电影时,图像冻结了几秒钟,工作了几秒钟,然后再次冻结。 CPU 使用率引起了我的注意,nvidia 驱动程序只使用一个 CPU,所以我想如果我能让 nvidia 使用两个 CPU,也许我会有更好的性能,并最终能够在我的 Linux 机器上观看高清电影。顺便说一句,我已经尝试了所有可能的 Linux 播放器:mplayer(甚至每晚构建)、totem、vlc 等等......

编辑: 中断平衡——调试

root@radu-work:/# irqbalance --debug
Package 0:  cpu mask is 00000001 (workload 0)
        Cache domain 0: cpu mask is 00000001  (workload 0) 
                CPU number 0  (workload 0)
                CPU number 0  (workload 0)
Package 0:  cpu mask is 00000003 (workload 0)
        Cache domain 0: cpu mask is 00000003  (workload 0) 
                CPU number 0  (workload 0)
                CPU number 1  (workload 0)
Interrupt 44 (class ethernet) has workload 7 
Interrupt 0 (class timer) has workload 0 
Interrupt 16 (class storage) has workload 122 
Interrupt 17 (class storage) has workload 29 
Interrupt 19 (class storage) has workload 0 
Interrupt 45 (class legacy) has workload 2 
Interrupt 1 (class legacy) has workload 2 
Interrupt 12 (class legacy) has workload 0 
-----------------------------------------------------------------------------
IRQ delta is 152640 
Rescanning cpu topology 
Package 0:  cpu mask is 00000001 (workload 0)
        Cache domain 0: cpu mask is 00000001  (workload 0) 
                CPU number 0  (workload 0)
                CPU number 0  (workload 0)
Package 0:  cpu mask is 00000003 (workload 0)
        Cache domain 0: cpu mask is 00000003  (workload 0) 
                CPU number 0  (workload 0)
                CPU number 1  (workload 0)
Package 0:  cpu mask is 00000001 (workload 16)
        Cache domain 0: cpu mask is 00000001  (workload 16) 
                CPU number 0  (workload 3)
                  Interrupt 44 (ethernet/2) 
                CPU number 0  (workload 0)
          Interrupt 17 (storage/9) 
          Interrupt 19 (storage/0) 
          Interrupt 45 (legacy/0) 
          Interrupt 12 (legacy/0) 
Package 0:  cpu mask is 00000003 (workload 42)
        Cache domain 0: cpu mask is 00000003  (workload 42) 
                CPU number 0  (workload 0)
                CPU number 1  (workload 0)
          Interrupt 16 (storage/40) 
          Interrupt 1 (legacy/0) 

-----------------------------------------------------------------------------
...
-----------------------------------------------------------------------------
IRQ delta is 10 
IRQ delta is 10, switching to power mode 
Rescanning cpu topology 
Package 0:  cpu mask is 00000001 (workload 0)
        Cache domain 0: cpu mask is 00000001  (workload 0) 
                CPU number 0  (workload 0)
                CPU number 0  (workload 0)
Package 0:  cpu mask is 00000003 (workload 0)
        Cache domain 0: cpu mask is 00000003  (workload 0) 
                CPU number 0  (workload 0)
                CPU number 1  (workload 0)
Package 0:  cpu mask is 00000001 (workload 38)
        Cache domain 0: cpu mask is 00000001  (workload 38) 
                CPU number 0  (workload 36)
                  Interrupt 44 (ethernet/35) 
                CPU number 0  (workload 0)
          Interrupt 16 (storage/0) 
          Interrupt 1 (legacy/0) 
Package 0:  cpu mask is 00000003 (workload 4)
        Cache domain 0: cpu mask is 00000003  (workload 4) 
                CPU number 0  (workload 0)
                CPU number 1  (workload 0)
          Interrupt 19 (storage/0) 
          Interrupt 17 (storage/0) 
          Interrupt 45 (legacy/0) 
          Interrupt 12 (legacy/0) 

答案1

你找错了树。让两个 CPU 都收到中断会使性能变得更差,而不是更好。一方面,这意味着软件解码器会不断被中断。另一方面,这意味着中断代码在缓存中不太可能很热。还有很多其他原因会让事情变得更糟。

答案2

你看过吗中断平衡?看起来它会解决你想要做的事情。 Irqbalance 还考虑缓存以及一次运行的核心数量文档,这是修改 /proc 条目无法实现的。

(我不相信您的问题完全是由于缺乏中断共享造成的 - 因为几秒钟的暂停听起来像是磁盘的性能问题等?)。

相关内容