1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | [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]# |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | void __init init_hardirqs(void) { …… for (i = 0; i < NR_IRQS; i++) { irq_desc_t *desc = irq_desc + i; if (desc->action && !(desc->status & IRQ_NODELAY)) desc->thread = kthread_create(do_irqd, desc, "IRQ %d", irq); …… } } static int do_irqd(void * __desc) { …… /* * Scale irq thread priorities from prio 50 to prio 25 */ param.sched_priority = curr_irq_prio; if (param.sched_priority > 25) curr_irq_prio = param.sched_priority - 1; …… } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | fastcall notrace unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs) { …… if (redirect_hardirq(desc)) goto out_no_end; …… action_ret = handle_IRQ_event(irq, regs, action); …… } int redirect_hardirq(struct irq_desc *desc) { …… if (!hardirq_preemption || (desc->status & IRQ_NODELAY) || !desc->thread) return 0; …… if (desc->thread && desc->thread->state != TASK_RUNNING) wake_up_process(desc->thread); …… } |
1 2 3 | static struct irqaction irq0 = { timer_interrupt, SA_INTERRUPT | SA_NODELAY, CPU_MASK_NONE, "timer", NULL, NULL }; |
1 2 | late_initcall(balanced_irq_init); #define late_initcall(fn) module_init(fn) //include\linux\init.h |
1 2 3 4 5 6 7 8 9 | static int __init balanced_irq_init(void) { …… printk(KERN_INFO "Starting balanced_irq\n"); if (kernel_thread(balanced_irq, NULL, CLONE_KERNEL) >= 0) return 0; else printk(KERN_ERR "balanced_irq_init: failed to spawn balanced_irq"); …… } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |