Chinaunix首页 | 论坛 | 博客
  • 博客访问: 653234
  • 博文数量: 135
  • 博客积分: 5217
  • 博客等级: 大校
  • 技术积分: 1289
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-05 17:36
文章分类

全部博文(135)

文章存档

2016年(1)

2012年(5)

2011年(15)

2010年(63)

2009年(51)

分类: LINUX

2009-11-21 22:11:25

现在的服务器一般都是多核了,但是中断很多时候都是只用一个核,如果有些中断要求比较高,可以把它独立分配给一个cpu使用。

查看irq资源

cat /proc/interrupts

 

           CPU0       CPU1       CPU2       CPU3
0: 131 0 0 1914 IO-APIC-edge timer
1: 0 0 0 2 IO-APIC-edge i8042
6: 0 0 0 3 IO-APIC-edge floppy
8: 0 0 0 0 IO-APIC-edge rtc
9: 0 0 0 1 IO-APIC-fasteoi acpi
12: 0 0 0 4 IO-APIC-edge i8042
16: 0 0 0 88 IO-APIC-fasteoi uhci_hcd:usb1
18: 0 0 0 0 IO-APIC-fasteoi uhci_hcd:usb2
19: 0 0 0 0 IO-APIC-fasteoi uhci_hcd:usb3
20: 0 0 0 3632390 IO-APIC-fasteoi eth0
21: 0 0 0 286964 IO-APIC-fasteoi eth1
22: 0 0 0 122 IO-APIC-fasteoi ehci_hcd:usb4, ide0
23: 0 0 0 71154 IO-APIC-fasteoi megaraid
24: 22742 71684193 0 501949119 IO-APIC-fasteoi wct4xxp
NMI: 0 0 0 0 Non-maskable interrupts
LOC: 2928977 1633788 6945258 8115638 Local timer interrupts
RES: 1507 2361 3804 3442 Rescheduling interrupts
CAL: 263 226 288 168 function call interrupts
TLB: 5488 4201 5293 3658 TLB shootdowns
TRM: 0 0 0 0 Thermal event interrupts
SPU: 0 0 0 0 Spurious interrupts
ERR: 0
MIS: 0

wct4xxp 就是E1卡TE410P,这个对中端要求比较高,所以分配到独立的cpu来处理,irq号是24

cat /proc/irq/24/smp_affinity
00000003

smp_affinity 文件默认是全部ffffffff,8个f就是16的8次方位,一般一台机就几只cpu,所以够了,echo 3 > /proc/irq/24/smp_affinity 就是分配第一第二只cpu给该irq。

 

smp_affinity 具体定义:

Binding IRQ’s to a group of CPU’s is a new feature of the 2.4 kernel. While it was originally developed as part of Red Hat Content Accelerator, it is now a generic and independent kernel feature. Every IRQ source in Linux has an entry in /proc/irq directory. For example, the settings for IRQ 40 is stored in /proc/irq/40. IRQ affinity, or IRQ bindings, is configured though the smp_affinity setting in that directory. For example, the smp_affinity for IRQ 40 is in /proc/irq/40/smp_affinity. The value of the smp_affinity setting is a bitmask of all CPU’s that are permitted as a resource for the given IRQ. The default value for smp_affinity is the HEX value 0xffffffff. This means the processes for the IRQ are sent to all CPU’s. You are not allowed to turn off all CPU’s for an IRQ. If the IRQ controller does not support IRQ affinity, the value can not be changed from the default. If multiple CPU’s are defined, then the IRQ source uses the least busy CPU. This is called ‘lowest priority APIC routing.’ IRQ affinity is achieved by binding an IRQ to a specific CPU or group of CPU’s by echoing a HEX value to smp_affinity for the IRQ.

阅读(3483) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~