69

I was feeling Ubuntu was running a bit sluggish, and then I went to see the processes running on it, and found one which was using something like 50% of CPU called ksoftirqd/0.

Does anyone know what this process does, why it is using so much CPU and how to make it less CPU-intensive?

80

Your computer communicates with the devices attached to it through IRQs (interrupt requests). When an interrupt comes from a device, the operating system pauses what it was doing and starts addressing that interrupt.

In some situations IRQs come very very fast one after the other and the operating system cannot finish servicing one before another one arrives. This can happen when a high speed network card receives a very large number of packets in a short time frame.

Because the operating system cannot handle IRQs as they arrive (because they arrive too fast one after the other), the operating system queues them for later processing by a special internal process named ksoftirqd.

If ksoftirqd is taking more than a tiny percentage of CPU time, this indicates the machine is under heavy interrupt load.

22

From the man page, ksoftirqd is a per-cpu kernel thread that runs when the machine is under heavy soft-interrupt load.

You can tweak the settings a bit, by defining which cpu picks up a certain interrupt. You do this by changing the contents of /proc/irq/$interrupt_number/smp_affinity. You can get a list of interrupts and their meaning by doing:

cat /proc/interrupts

The number in smp_affinity is a bitmap of cpus, represented in hex code. The rightmost bit is the least significant. For instance, my system has 8 cores. If I wanted to use only cores 1, 3 and 4, I would set the smp_affinity to 1a:

cpu_7 cpu_6 cpu_5 cpu_4 cpu_3 cpu_2 cpu_1 cpu_0
  0     0     0     1     1     0     1     0    = 0001 1010 = 1a (in hex)

Personally, I set up any cpu to be able to pick up interrupt 29 (eth0 in my 8-core system) with:

sudo echo ff > /proc/irq/29/smp_affinity
4

ksoftirqd is a per-cpu kernel thread that runs when the machine is under heavy soft-interrupt load.So, it is not eating your cpu but rather reducing your IRQ load.

  • 1
    I know it's askubuntu.com, but on Raspberry Pi is quite the opposite, ksoftirqd is eating all of the CPU on intensive IRQ load. – machineaddict Dec 20 '15 at 12:50
  • As I understand it ksoftirqd processes postponed softirqs (when they cannot be processed quickly enough). When there is a lot of softirqs and/or they consume a lot of CPU time to process then ksoftirqd consumes a lot of CPU time. – pabouk Apr 6 '18 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.