Skip to contentSkip to conversation

proc/stat: Separate out individual irq counts into /proc/stat_irqs

PATCH New Waiman Long 1 participant 1 message Apr 19, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 proc/stat: Separate out individual irq counts into /proc/stat_irqs

It was found that reading /proc/stat could be time consuming on systems with a lot of irqs. For example, reading /proc/stat in a certain 2-socket Skylake server took about 4.6ms because it had over 5k irqs. In that particular case, the majority of the CPU cycles for reading /proc/stat was spent in the kstat_irqs() function. Therefore, application performance can be impacted if the application reads /proc/stat rather frequently.

The "intr" line within /proc/stat contains a sum total of all the irqs that have been serviced followed by a list of irq counts for each individual irq number. In many cases, the first number is good enough. The individual irq counts may not provide that much more information.

In order to avoid this kind of performance issue, all these individual irq counts are now separated into a new /proc/stat_irqs file. The sum total irq count will stay in /proc/stat and be duplicated in /proc/stat_irqs. Applications that need to look up individual irq counts will now have to look into /proc/stat_irqs instead of /proc/stat.

v2: Update Documentation/filesystems/proc.txt accordingly.

---
 Documentation/filesystems/proc.txt | 22 ++++++++++++-----
 fs/proc/stat.c                     | 48 ++++++++++++++++++++++++++++++++------
 2 files changed, 57 insertions(+), 13 deletions(-)
Documentation/filesystems/proc.txt +16 -6
index 2a84bb3..15558ff 100644
@@ -1300,7 +1300,7 @@ since the system first booted.  For a quick look, simply cat the file:
   cpu  2255 34 2290 22625563 6290 127 456 0 0 0
   cpu0 1132 34 1441 11311718 3675 127 438 0 0 0
   cpu1 1123 0 849 11313845 2614 0 18 0 0 0
-  intr 114930548 113199788 3 0 5 263 0 4 [... lots more numbers ...]
+  intr 114930548
   ctxt 1990473
   btime 1062191376
   processes 2915
@@ -1333,11 +1333,10 @@ second).  The meanings of the columns are as follows, from left to right:
 - guest: running a normal guest
 - guest_nice: running a niced guest
 
-The "intr" line gives counts of interrupts  serviced since boot time, for each
-of the  possible system interrupts.   The first  column  is the  total of  all
-interrupts serviced  including  unnumbered  architecture specific  interrupts;
-each  subsequent column is the  total for that particular numbered interrupt.
-Unnumbered interrupts are not shown, only summed into the total.
+The "intr" line gives the total of all interrupts including unnumbered
+architecture specific interrupts serviced since boot time.  To see the
+number of interrupts serviced for a particular numbered interrupt,
+the /proc/stat_irqs file should be used instead.
 
 The "ctxt" line gives the total number of context switches across all CPUs.
 
@@ -1359,6 +1358,17 @@ of the possible system softirqs. The first column is the total of all
 softirqs serviced; each subsequent column is the total for that particular
 softirq.
 
+To see the number of interrupts serviced for each of the numbered
+interrupts, the /proc/stat_irqs file can be viewed.
+
+  > cat /proc/stat_irqs
+  intr 114930548 113199788 3 0 5 263 0 4 [... lots more numbers ...]
+
+The "intr" line gives counts of interrupts  serviced since boot time, for each
+of the  possible system interrupts.   The first  column  is the  total of  all
+interrupts serviced  including  unnumbered  architecture specific  interrupts;
+each  subsequent column is the  total for that particular numbered interrupt.
+Unnumbered interrupts are not shown, only summed into the total.
 
 1.9 Ext4 file system parameters
 -------------------------------
fs/proc/stat.c +41 -7

76 lines not on this page · raw message

Signature · 1 line
1.8.3.1