How to give highest priority to ethernet interrupt

2020-06-23 05:41发布

问题:

I listed all interrupts with this:

cat /proc/interruts

it gives this:

        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.)

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?

回答1:

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.

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.

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

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.