diff options
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/proc/proc_misc.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 61b25f4eabe6..7ea52c79b2da 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> |
| @@ -521,17 +522,13 @@ static const struct file_operations proc_vmalloc_operations = { | |||
| 521 | 522 | ||
| 522 | static int show_stat(struct seq_file *p, void *v) | 523 | static int show_stat(struct seq_file *p, void *v) |
| 523 | { | 524 | { |
| 524 | int i; | 525 | int i, j; |
| 525 | unsigned long jif; | 526 | unsigned long jif; |
| 526 | cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; | 527 | cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; |
| 527 | cputime64_t guest; | 528 | cputime64_t guest; |
| 528 | u64 sum = 0; | 529 | u64 sum = 0; |
| 529 | struct timespec boottime; | 530 | struct timespec boottime; |
| 530 | unsigned int *per_irq_sum; | 531 | unsigned int per_irq_sum; |
| 531 | |||
| 532 | per_irq_sum = kzalloc(sizeof(unsigned int)*NR_IRQS, GFP_KERNEL); | ||
| 533 | if (!per_irq_sum) | ||
| 534 | return -ENOMEM; | ||
| 535 | 532 | ||
| 536 | user = nice = system = idle = iowait = | 533 | user = nice = system = idle = iowait = |
| 537 | irq = softirq = steal = cputime64_zero; | 534 | irq = softirq = steal = cputime64_zero; |
| @@ -540,8 +537,6 @@ static int show_stat(struct seq_file *p, void *v) | |||
| 540 | jif = boottime.tv_sec; | 537 | jif = boottime.tv_sec; |
| 541 | 538 | ||
| 542 | for_each_possible_cpu(i) { | 539 | for_each_possible_cpu(i) { |
| 543 | int j; | ||
| 544 | |||
| 545 | user = cputime64_add(user, kstat_cpu(i).cpustat.user); | 540 | user = cputime64_add(user, kstat_cpu(i).cpustat.user); |
| 546 | nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice); | 541 | nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice); |
| 547 | system = cputime64_add(system, kstat_cpu(i).cpustat.system); | 542 | system = cputime64_add(system, kstat_cpu(i).cpustat.system); |
| @@ -551,11 +546,10 @@ static int show_stat(struct seq_file *p, void *v) | |||
| 551 | softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq); | 546 | softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq); |
| 552 | steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal); | 547 | steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal); |
| 553 | guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest); | 548 | guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest); |
| 554 | for (j = 0; j < NR_IRQS; j++) { | 549 | |
| 555 | unsigned int temp = kstat_cpu(i).irqs[j]; | 550 | for_each_irq_nr(j) |
| 556 | sum += temp; | 551 | sum += kstat_irqs_cpu(j, i); |
| 557 | per_irq_sum[j] += temp; | 552 | |
| 558 | } | ||
| 559 | sum += arch_irq_stat_cpu(i); | 553 | sum += arch_irq_stat_cpu(i); |
| 560 | } | 554 | } |
| 561 | sum += arch_irq_stat(); | 555 | sum += arch_irq_stat(); |
| @@ -597,8 +591,15 @@ static int show_stat(struct seq_file *p, void *v) | |||
| 597 | } | 591 | } |
| 598 | seq_printf(p, "intr %llu", (unsigned long long)sum); | 592 | seq_printf(p, "intr %llu", (unsigned long long)sum); |
| 599 | 593 | ||
| 600 | for (i = 0; i < NR_IRQS; i++) | 594 | /* sum again ? it could be updated? */ |
| 601 | seq_printf(p, " %u", per_irq_sum[i]); | 595 | for_each_irq_nr(j) { |
| 596 | per_irq_sum = 0; | ||
| 597 | |||
| 598 | for_each_possible_cpu(i) | ||
| 599 | per_irq_sum += kstat_irqs_cpu(j, i); | ||
| 600 | |||
| 601 | seq_printf(p, " %u", per_irq_sum); | ||
| 602 | } | ||
| 602 | 603 | ||
| 603 | seq_printf(p, | 604 | seq_printf(p, |
| 604 | "\nctxt %llu\n" | 605 | "\nctxt %llu\n" |
| @@ -612,7 +613,6 @@ static int show_stat(struct seq_file *p, void *v) | |||
| 612 | nr_running(), | 613 | nr_running(), |
| 613 | nr_iowait()); | 614 | nr_iowait()); |
| 614 | 615 | ||
| 615 | kfree(per_irq_sum); | ||
| 616 | return 0; | 616 | return 0; |
| 617 | } | 617 | } |
| 618 | 618 | ||
| @@ -651,15 +651,14 @@ static const struct file_operations proc_stat_operations = { | |||
| 651 | */ | 651 | */ |
| 652 | static void *int_seq_start(struct seq_file *f, loff_t *pos) | 652 | static void *int_seq_start(struct seq_file *f, loff_t *pos) |
| 653 | { | 653 | { |
| 654 | return (*pos <= NR_IRQS) ? pos : NULL; | 654 | return (*pos <= nr_irqs) ? pos : NULL; |
| 655 | } | 655 | } |
| 656 | 656 | ||
| 657 | |||
| 657 | static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos) | 658 | static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos) |
| 658 | { | 659 | { |
| 659 | (*pos)++; | 660 | (*pos)++; |
| 660 | if (*pos > NR_IRQS) | 661 | return (*pos <= nr_irqs) ? pos : NULL; |
| 661 | return NULL; | ||
| 662 | return pos; | ||
| 663 | } | 662 | } |
| 664 | 663 | ||
| 665 | static void int_seq_stop(struct seq_file *f, void *v) | 664 | static void int_seq_stop(struct seq_file *f, void *v) |
| @@ -667,7 +666,6 @@ static void int_seq_stop(struct seq_file *f, void *v) | |||
| 667 | /* Nothing to do */ | 666 | /* Nothing to do */ |
| 668 | } | 667 | } |
| 669 | 668 | ||
| 670 | |||
| 671 | static const struct seq_operations int_seq_ops = { | 669 | static const struct seq_operations int_seq_ops = { |
| 672 | .start = int_seq_start, | 670 | .start = int_seq_start, |
| 673 | .next = int_seq_next, | 671 | .next = int_seq_next, |
