diff options
Diffstat (limited to 'fs/proc/proc_misc.c')
-rw-r--r-- | fs/proc/proc_misc.c | 125 |
1 files changed, 72 insertions, 53 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 59ea42e1ef03..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> |
@@ -136,6 +137,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
136 | unsigned long allowed; | 137 | unsigned long allowed; |
137 | struct vmalloc_info vmi; | 138 | struct vmalloc_info vmi; |
138 | long cached; | 139 | long cached; |
140 | unsigned long pages[NR_LRU_LISTS]; | ||
141 | int lru; | ||
139 | 142 | ||
140 | /* | 143 | /* |
141 | * display in kilobytes. | 144 | * display in kilobytes. |
@@ -154,51 +157,70 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
154 | 157 | ||
155 | get_vmalloc_info(&vmi); | 158 | get_vmalloc_info(&vmi); |
156 | 159 | ||
160 | for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++) | ||
161 | pages[lru] = global_page_state(NR_LRU_BASE + lru); | ||
162 | |||
157 | /* | 163 | /* |
158 | * Tagged format, for easy grepping and expansion. | 164 | * Tagged format, for easy grepping and expansion. |
159 | */ | 165 | */ |
160 | len = sprintf(page, | 166 | len = sprintf(page, |
161 | "MemTotal: %8lu kB\n" | 167 | "MemTotal: %8lu kB\n" |
162 | "MemFree: %8lu kB\n" | 168 | "MemFree: %8lu kB\n" |
163 | "Buffers: %8lu kB\n" | 169 | "Buffers: %8lu kB\n" |
164 | "Cached: %8lu kB\n" | 170 | "Cached: %8lu kB\n" |
165 | "SwapCached: %8lu kB\n" | 171 | "SwapCached: %8lu kB\n" |
166 | "Active: %8lu kB\n" | 172 | "Active: %8lu kB\n" |
167 | "Inactive: %8lu kB\n" | 173 | "Inactive: %8lu kB\n" |
174 | "Active(anon): %8lu kB\n" | ||
175 | "Inactive(anon): %8lu kB\n" | ||
176 | "Active(file): %8lu kB\n" | ||
177 | "Inactive(file): %8lu kB\n" | ||
178 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
179 | "Unevictable: %8lu kB\n" | ||
180 | "Mlocked: %8lu kB\n" | ||
181 | #endif | ||
168 | #ifdef CONFIG_HIGHMEM | 182 | #ifdef CONFIG_HIGHMEM |
169 | "HighTotal: %8lu kB\n" | 183 | "HighTotal: %8lu kB\n" |
170 | "HighFree: %8lu kB\n" | 184 | "HighFree: %8lu kB\n" |
171 | "LowTotal: %8lu kB\n" | 185 | "LowTotal: %8lu kB\n" |
172 | "LowFree: %8lu kB\n" | 186 | "LowFree: %8lu kB\n" |
173 | #endif | 187 | #endif |
174 | "SwapTotal: %8lu kB\n" | 188 | "SwapTotal: %8lu kB\n" |
175 | "SwapFree: %8lu kB\n" | 189 | "SwapFree: %8lu kB\n" |
176 | "Dirty: %8lu kB\n" | 190 | "Dirty: %8lu kB\n" |
177 | "Writeback: %8lu kB\n" | 191 | "Writeback: %8lu kB\n" |
178 | "AnonPages: %8lu kB\n" | 192 | "AnonPages: %8lu kB\n" |
179 | "Mapped: %8lu kB\n" | 193 | "Mapped: %8lu kB\n" |
180 | "Slab: %8lu kB\n" | 194 | "Slab: %8lu kB\n" |
181 | "SReclaimable: %8lu kB\n" | 195 | "SReclaimable: %8lu kB\n" |
182 | "SUnreclaim: %8lu kB\n" | 196 | "SUnreclaim: %8lu kB\n" |
183 | "PageTables: %8lu kB\n" | 197 | "PageTables: %8lu kB\n" |
184 | #ifdef CONFIG_QUICKLIST | 198 | #ifdef CONFIG_QUICKLIST |
185 | "Quicklists: %8lu kB\n" | 199 | "Quicklists: %8lu kB\n" |
186 | #endif | 200 | #endif |
187 | "NFS_Unstable: %8lu kB\n" | 201 | "NFS_Unstable: %8lu kB\n" |
188 | "Bounce: %8lu kB\n" | 202 | "Bounce: %8lu kB\n" |
189 | "WritebackTmp: %8lu kB\n" | 203 | "WritebackTmp: %8lu kB\n" |
190 | "CommitLimit: %8lu kB\n" | 204 | "CommitLimit: %8lu kB\n" |
191 | "Committed_AS: %8lu kB\n" | 205 | "Committed_AS: %8lu kB\n" |
192 | "VmallocTotal: %8lu kB\n" | 206 | "VmallocTotal: %8lu kB\n" |
193 | "VmallocUsed: %8lu kB\n" | 207 | "VmallocUsed: %8lu kB\n" |
194 | "VmallocChunk: %8lu kB\n", | 208 | "VmallocChunk: %8lu kB\n", |
195 | K(i.totalram), | 209 | K(i.totalram), |
196 | K(i.freeram), | 210 | K(i.freeram), |
197 | K(i.bufferram), | 211 | K(i.bufferram), |
198 | K(cached), | 212 | K(cached), |
199 | K(total_swapcache_pages), | 213 | K(total_swapcache_pages), |
200 | K(global_page_state(NR_ACTIVE)), | 214 | K(pages[LRU_ACTIVE_ANON] + pages[LRU_ACTIVE_FILE]), |
201 | K(global_page_state(NR_INACTIVE)), | 215 | K(pages[LRU_INACTIVE_ANON] + pages[LRU_INACTIVE_FILE]), |
216 | K(pages[LRU_ACTIVE_ANON]), | ||
217 | K(pages[LRU_INACTIVE_ANON]), | ||
218 | K(pages[LRU_ACTIVE_FILE]), | ||
219 | K(pages[LRU_INACTIVE_FILE]), | ||
220 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
221 | K(pages[LRU_UNEVICTABLE]), | ||
222 | K(global_page_state(NR_MLOCK)), | ||
223 | #endif | ||
202 | #ifdef CONFIG_HIGHMEM | 224 | #ifdef CONFIG_HIGHMEM |
203 | K(i.totalhigh), | 225 | K(i.totalhigh), |
204 | K(i.freehigh), | 226 | K(i.freehigh), |
@@ -500,17 +522,13 @@ static const struct file_operations proc_vmalloc_operations = { | |||
500 | 522 | ||
501 | static int show_stat(struct seq_file *p, void *v) | 523 | static int show_stat(struct seq_file *p, void *v) |
502 | { | 524 | { |
503 | int i; | 525 | int i, j; |
504 | unsigned long jif; | 526 | unsigned long jif; |
505 | cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; | 527 | cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; |
506 | cputime64_t guest; | 528 | cputime64_t guest; |
507 | u64 sum = 0; | 529 | u64 sum = 0; |
508 | struct timespec boottime; | 530 | struct timespec boottime; |
509 | unsigned int *per_irq_sum; | 531 | unsigned int per_irq_sum; |
510 | |||
511 | per_irq_sum = kzalloc(sizeof(unsigned int)*NR_IRQS, GFP_KERNEL); | ||
512 | if (!per_irq_sum) | ||
513 | return -ENOMEM; | ||
514 | 532 | ||
515 | user = nice = system = idle = iowait = | 533 | user = nice = system = idle = iowait = |
516 | irq = softirq = steal = cputime64_zero; | 534 | irq = softirq = steal = cputime64_zero; |
@@ -519,8 +537,6 @@ static int show_stat(struct seq_file *p, void *v) | |||
519 | jif = boottime.tv_sec; | 537 | jif = boottime.tv_sec; |
520 | 538 | ||
521 | for_each_possible_cpu(i) { | 539 | for_each_possible_cpu(i) { |
522 | int j; | ||
523 | |||
524 | user = cputime64_add(user, kstat_cpu(i).cpustat.user); | 540 | user = cputime64_add(user, kstat_cpu(i).cpustat.user); |
525 | nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice); | 541 | nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice); |
526 | system = cputime64_add(system, kstat_cpu(i).cpustat.system); | 542 | system = cputime64_add(system, kstat_cpu(i).cpustat.system); |
@@ -530,11 +546,10 @@ static int show_stat(struct seq_file *p, void *v) | |||
530 | softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq); | 546 | softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq); |
531 | steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal); | 547 | steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal); |
532 | guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest); | 548 | guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest); |
533 | for (j = 0; j < NR_IRQS; j++) { | 549 | |
534 | unsigned int temp = kstat_cpu(i).irqs[j]; | 550 | for_each_irq_nr(j) |
535 | sum += temp; | 551 | sum += kstat_irqs_cpu(j, i); |
536 | per_irq_sum[j] += temp; | 552 | |
537 | } | ||
538 | sum += arch_irq_stat_cpu(i); | 553 | sum += arch_irq_stat_cpu(i); |
539 | } | 554 | } |
540 | sum += arch_irq_stat(); | 555 | sum += arch_irq_stat(); |
@@ -576,8 +591,15 @@ static int show_stat(struct seq_file *p, void *v) | |||
576 | } | 591 | } |
577 | seq_printf(p, "intr %llu", (unsigned long long)sum); | 592 | seq_printf(p, "intr %llu", (unsigned long long)sum); |
578 | 593 | ||
579 | for (i = 0; i < NR_IRQS; i++) | 594 | /* sum again ? it could be updated? */ |
580 | 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 | } | ||
581 | 603 | ||
582 | seq_printf(p, | 604 | seq_printf(p, |
583 | "\nctxt %llu\n" | 605 | "\nctxt %llu\n" |
@@ -591,7 +613,6 @@ static int show_stat(struct seq_file *p, void *v) | |||
591 | nr_running(), | 613 | nr_running(), |
592 | nr_iowait()); | 614 | nr_iowait()); |
593 | 615 | ||
594 | kfree(per_irq_sum); | ||
595 | return 0; | 616 | return 0; |
596 | } | 617 | } |
597 | 618 | ||
@@ -630,15 +651,14 @@ static const struct file_operations proc_stat_operations = { | |||
630 | */ | 651 | */ |
631 | 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) |
632 | { | 653 | { |
633 | return (*pos <= NR_IRQS) ? pos : NULL; | 654 | return (*pos <= nr_irqs) ? pos : NULL; |
634 | } | 655 | } |
635 | 656 | ||
657 | |||
636 | 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) |
637 | { | 659 | { |
638 | (*pos)++; | 660 | (*pos)++; |
639 | if (*pos > NR_IRQS) | 661 | return (*pos <= nr_irqs) ? pos : NULL; |
640 | return NULL; | ||
641 | return pos; | ||
642 | } | 662 | } |
643 | 663 | ||
644 | static void int_seq_stop(struct seq_file *f, void *v) | 664 | static void int_seq_stop(struct seq_file *f, void *v) |
@@ -646,7 +666,6 @@ static void int_seq_stop(struct seq_file *f, void *v) | |||
646 | /* Nothing to do */ | 666 | /* Nothing to do */ |
647 | } | 667 | } |
648 | 668 | ||
649 | |||
650 | static const struct seq_operations int_seq_ops = { | 669 | static const struct seq_operations int_seq_ops = { |
651 | .start = int_seq_start, | 670 | .start = int_seq_start, |
652 | .next = int_seq_next, | 671 | .next = int_seq_next, |