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

查看:28
本文介绍了如何在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.)

该表的第一列是否给出了中断的优先级?我只是想了解优先级,因为我想提高网卡的中断优先级以获得更好的网络性能.我认为,前两个中断不能改变(我猜是由于 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:

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

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

推荐答案

vanilla 内核不优先考虑中断.这是内核开发中的一个早期设计决策.有两种方法可以解决这个问题.

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天全站免登陆