如何在Linux中为以太网中断赋予最高优先级 [英] How to give highest priority to ethernet interrupt in linux

查看:1561
本文介绍了如何在Linux中为以太网中断赋予最高优先级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我列出了所有与此相关的中断:

I listed all interrupts with this:

cat /proc/interruts

它给出了这一点:

        CPU0        CPU1         CPU2        CPU3
    0:   126           0            0           0     IO-APIC-edge        timer
    1:   941           0            0           0     IO-APIC-edge        keyboard
    ... (etc.)
   19:   941           0            0           0     IO-APIC-fasteoi      eth0
    ... (etc.)

此表中的第一列是否给出了中断的优先级?我只想学习优先级,因为我想提高NIC的中断优先级,以获得更好的网络性能.我认为,前两个中断不能更改(我猜是由于intel x86体系结构造成的.)

Does the first column in this table give priority level of interrupts? I just want to learn priority levels, because I want to increase my NIC's interrupt priority level for better network performance. I think, first two interrupts cannot be changed (I guess due to intel x86 architecture).

无论如何,这是我的问题:

Anyway, here is my question:

是否可以提高NIC中断的优先级?

Is it possible to increase priority level of my NIC's interrupts?

推荐答案

原始内核不对中断进行优先级排序.这是内核开发中的一项早期设计决策.您可以通过两种方法解决此问题.

The vanilla kernel does not prioritize interrupts. This was an early design decision in the development of the kernel. There are two ways that you can get around this.

首先,您可以编写一个内核模块来对处理器的中断控制器进行编程,以使NIC中断具有最高优先级.这将在硬件级别更改内核下面的NIC中断优先级.

First, you can write a kernel module to program the interrupt controller for your processor to give the NIC interrupt highest priority. This will change the NIC interrupt priority underneath the kernel at the hardware level.

第二,您可以使用 PREEMPT_RT 补丁构建内核,并提供处理NIC的内核线程会中断最高优先级.

Second, you can build the kernel with the PREEMPT_RT patch and give the kernel thread that handles the NIC interrupts the highest priority.

这两种方法都会增加处理网络中断的优先级.但是,由于IP的大部分开销(UDP的TCP都在IP堆栈中,而不是在NIC中断的处理中),因此,这两种方法都不可能给您带来更好的网络性能(无论意味着什么).实际上,使用PREEMPT_RT补丁甚至可能导致网络性能下降.

Both of these approaches will increase the priority of the handling of the network interrupts. However, neither of these is likely to give you better network performance (whatever that means) because much of the overhead of IP, either TCP of UDP is in the IP stack, not in the processing of the NIC interrupts. In fact, using the PREEMPT_RT patch might even result in network performance degradation.

这篇关于如何在Linux中为以太网中断赋予最高优先级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆