How to Give Highest Priority to Ethernet Interrupt in Linux

How to give highest priority to ethernet interrupt in linux

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.

Set the process priority and the affinity of an irq process from C/C++

I solved it by using libprocps. It is possible to get the pid of the irq via the name of the gpio or of the spi device and then to set the cpu affinity/priority of the irq.

Need to improve the Linux performance for embedded system

Linux is not a real-time operating system. It offers no guarantees other than "best efforts" scheduling.

If you have a task which has to run at a particular rate all the time, you need to run that task under a proper RTOS which can make those sorts of guarantees.

Otherwise you have to relax your constraints to "runs every 4ms, mostly".



Related Topics



Leave a reply



Submit