What is the difference between /proc/interrupts and /proc/softirq in Linux?

6,843

softirqs aren't directly related to hardware interrupts, they're the successor to "bottom halves" and the predecessor of tasklets. The (old) Unreliable Guide to Hacking the Linux Kernel has a brief section on the topic; I dare say there are better resources elsewhere. The list of softirqs is defined in include/linux/interrupt.h; you'll see they don't correspond to single hardware interrupts.

Thus you shouldn't subtract /proc/softirq counts from /proc/interrupts. The latter only counts hardware interrupts; these of course may result in softirqs being used too, but there's no easy way of determining the correlation (e.g. between hardware interrupts on your network adapter and NET_RX or NET_TX softirqs).

Share:
6,843

Related videos on Youtube

jwbensley
Author by

jwbensley

Senior network engineer / architect Programmer Hobbyist hardware hacker/tinkerer

Updated on September 18, 2022

Comments

  • jwbensley
    jwbensley over 1 year

    /proc/softirq is softirq stats. Is /proc/interrupt both hard and soft interrupts or hard only?

    I want to measure the rate of hard and soft irq's per second roughly using watch -n 1 grep 'foo' /proc/softirq and watch -n 1 grep 'bar' /proc/interrupt so I can compare the rate of hardware interrupt increase to software interrupt.

    I'm wondering if I need to subtract /proc/softirq counts from /proc/interrupt to get the count of hardware IRQs because it counts both kinds or if /proc/interrupt is hardware only?

  • jwbensley
    jwbensley about 7 years
    Thanks for the response. I'm not trying to correlate them only measure them. I am aware that soft irqs and hard irqs are not directly related. I need to perf some software that uses both, so I want to see when it is running what the rate of hard and soft irq's are so I just wanted to make sure that /proc/softirq is soft only and /proc/interrupt is hard irqs only. You have confirmed this (which is what I thought to be the case).