aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/proc/proc_misc.c42
-rw-r--r--include/linux/interrupt.h5
2 files changed, 33 insertions, 14 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index aa069acf61a0..c3cbabe8b38e 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -30,6 +30,7 @@
30#include <linux/mm.h> 30#include <linux/mm.h>
31#include <linux/mmzone.h> 31#include <linux/mmzone.h>
32#include <linux/pagemap.h> 32#include <linux/pagemap.h>
33#include <linux/irq.h>
33#include <linux/interrupt.h> 34#include <linux/interrupt.h>
34#include <linux/swap.h> 35#include <linux/swap.h>
35#include <linux/slab.h> 36#include <linux/slab.h>
@@ -501,17 +502,16 @@ static const struct file_operations proc_vmalloc_operations = {
501 502
502static int show_stat(struct seq_file *p, void *v) 503static int show_stat(struct seq_file *p, void *v)
503{ 504{
504 int i; 505 int i, j;
505 unsigned long jif; 506 unsigned long jif;
506 cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; 507 cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
507 cputime64_t guest; 508 cputime64_t guest;
508 u64 sum = 0; 509 u64 sum = 0;
509 struct timespec boottime; 510 struct timespec boottime;
510 unsigned int *per_irq_sum; 511 unsigned int per_irq_sum;
511 512#ifdef CONFIG_GENERIC_HARDIRQS
512 per_irq_sum = kzalloc(sizeof(unsigned int)*nr_irqs, GFP_KERNEL); 513 struct irq_desc *desc;
513 if (!per_irq_sum) 514#endif
514 return -ENOMEM;
515 515
516 user = nice = system = idle = iowait = 516 user = nice = system = idle = iowait =
517 irq = softirq = steal = cputime64_zero; 517 irq = softirq = steal = cputime64_zero;
@@ -520,8 +520,6 @@ static int show_stat(struct seq_file *p, void *v)
520 jif = boottime.tv_sec; 520 jif = boottime.tv_sec;
521 521
522 for_each_possible_cpu(i) { 522 for_each_possible_cpu(i) {
523 int j;
524
525 user = cputime64_add(user, kstat_cpu(i).cpustat.user); 523 user = cputime64_add(user, kstat_cpu(i).cpustat.user);
526 nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice); 524 nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice);
527 system = cputime64_add(system, kstat_cpu(i).cpustat.system); 525 system = cputime64_add(system, kstat_cpu(i).cpustat.system);
@@ -531,10 +529,12 @@ static int show_stat(struct seq_file *p, void *v)
531 softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq); 529 softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
532 steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal); 530 steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
533 guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest); 531 guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
534 for (j = 0; j < nr_irqs; j++) { 532 for_each_irq_desc(j, desc)
535 unsigned int temp = kstat_irqs_cpu(j, i); 533 {
534 unsigned int temp;
535
536 temp = kstat_irqs_cpu(j, i);
536 sum += temp; 537 sum += temp;
537 per_irq_sum[j] += temp;
538 } 538 }
539 sum += arch_irq_stat_cpu(i); 539 sum += arch_irq_stat_cpu(i);
540 } 540 }
@@ -577,8 +577,23 @@ static int show_stat(struct seq_file *p, void *v)
577 } 577 }
578 seq_printf(p, "intr %llu", (unsigned long long)sum); 578 seq_printf(p, "intr %llu", (unsigned long long)sum);
579 579
580 for (i = 0; i < nr_irqs; i++) 580 /* sum again ? it could be updated? */
581 seq_printf(p, " %u", per_irq_sum[i]); 581 for_each_irq_desc(j, desc)
582 {
583 per_irq_sum = 0;
584 for_each_possible_cpu(i) {
585 unsigned int temp;
586
587 temp = kstat_irqs_cpu(j, i);
588 per_irq_sum += temp;
589 }
590
591#ifdef CONFIG_HAVE_SPARSE_IRQ
592 seq_printf(p, " %u:%u", j, per_irq_sum);
593#else
594 seq_printf(p, " %u", per_irq_sum);
595#endif
596 }
582 597
583 seq_printf(p, 598 seq_printf(p,
584 "\nctxt %llu\n" 599 "\nctxt %llu\n"
@@ -592,7 +607,6 @@ static int show_stat(struct seq_file *p, void *v)
592 nr_running(), 607 nr_running(),
593 nr_iowait()); 608 nr_iowait());
594 609
595 kfree(per_irq_sum);
596 return 0; 610 return 0;
597} 611}
598 612
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 511803853a5b..d4039a0b23f4 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -17,6 +17,11 @@
17 17
18extern int nr_irqs; 18extern int nr_irqs;
19 19
20#ifndef CONFIG_GENERIC_HARDIRQS
21#define for_each_irq_desc(irq, desc) \
22 for (irq = 0; irq < nr_irqs; irq++)
23#endif
24
20/* 25/*
21 * These correspond to the IORESOURCE_IRQ_* defines in 26 * These correspond to the IORESOURCE_IRQ_* defines in
22 * linux/ioport.h to select the interrupt line behaviour. When 27 * linux/ioport.h to select the interrupt line behaviour. When