aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/proc_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/proc_misc.c')
-rw-r--r--fs/proc/proc_misc.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 74a323d2b85..c652d469dc0 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -123,6 +123,11 @@ static int uptime_read_proc(char *page, char **start, off_t off,
123 return proc_calc_metrics(page, start, off, count, eof, len); 123 return proc_calc_metrics(page, start, off, count, eof, len);
124} 124}
125 125
126int __attribute__((weak)) arch_report_meminfo(char *page)
127{
128 return 0;
129}
130
126static int meminfo_read_proc(char *page, char **start, off_t off, 131static int meminfo_read_proc(char *page, char **start, off_t off,
127 int count, int *eof, void *data) 132 int count, int *eof, void *data)
128{ 133{
@@ -139,7 +144,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
139#define K(x) ((x) << (PAGE_SHIFT - 10)) 144#define K(x) ((x) << (PAGE_SHIFT - 10))
140 si_meminfo(&i); 145 si_meminfo(&i);
141 si_swapinfo(&i); 146 si_swapinfo(&i);
142 committed = atomic_read(&vm_committed_space); 147 committed = atomic_long_read(&vm_committed_space);
143 allowed = ((totalram_pages - hugetlb_total_pages()) 148 allowed = ((totalram_pages - hugetlb_total_pages())
144 * sysctl_overcommit_ratio / 100) + total_swap_pages; 149 * sysctl_overcommit_ratio / 100) + total_swap_pages;
145 150
@@ -221,6 +226,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
221 226
222 len += hugetlb_report_meminfo(page + len); 227 len += hugetlb_report_meminfo(page + len);
223 228
229 len += arch_report_meminfo(page + len);
230
224 return proc_calc_metrics(page, start, off, count, eof, len); 231 return proc_calc_metrics(page, start, off, count, eof, len);
225#undef K 232#undef K
226} 233}
@@ -472,6 +479,13 @@ static const struct file_operations proc_vmalloc_operations = {
472}; 479};
473#endif 480#endif
474 481
482#ifndef arch_irq_stat_cpu
483#define arch_irq_stat_cpu(cpu) 0
484#endif
485#ifndef arch_irq_stat
486#define arch_irq_stat() 0
487#endif
488
475static int show_stat(struct seq_file *p, void *v) 489static int show_stat(struct seq_file *p, void *v)
476{ 490{
477 int i; 491 int i;
@@ -509,7 +523,9 @@ static int show_stat(struct seq_file *p, void *v)
509 sum += temp; 523 sum += temp;
510 per_irq_sum[j] += temp; 524 per_irq_sum[j] += temp;
511 } 525 }
526 sum += arch_irq_stat_cpu(i);
512 } 527 }
528 sum += arch_irq_stat();
513 529
514 seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", 530 seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
515 (unsigned long long)cputime64_to_clock_t(user), 531 (unsigned long long)cputime64_to_clock_t(user),
@@ -716,7 +732,7 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf,
716 pfn = src / KPMSIZE; 732 pfn = src / KPMSIZE;
717 count = min_t(size_t, count, (max_pfn * KPMSIZE) - src); 733 count = min_t(size_t, count, (max_pfn * KPMSIZE) - src);
718 if (src & KPMMASK || count & KPMMASK) 734 if (src & KPMMASK || count & KPMMASK)
719 return -EIO; 735 return -EINVAL;
720 736
721 while (count > 0) { 737 while (count > 0) {
722 ppage = NULL; 738 ppage = NULL;
@@ -726,7 +742,7 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf,
726 if (!ppage) 742 if (!ppage)
727 pcount = 0; 743 pcount = 0;
728 else 744 else
729 pcount = atomic_read(&ppage->_count); 745 pcount = page_mapcount(ppage);
730 746
731 if (put_user(pcount, out++)) { 747 if (put_user(pcount, out++)) {
732 ret = -EFAULT; 748 ret = -EFAULT;
@@ -782,7 +798,7 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf,
782 pfn = src / KPMSIZE; 798 pfn = src / KPMSIZE;
783 count = min_t(unsigned long, count, (max_pfn * KPMSIZE) - src); 799 count = min_t(unsigned long, count, (max_pfn * KPMSIZE) - src);
784 if (src & KPMMASK || count & KPMMASK) 800 if (src & KPMMASK || count & KPMMASK)
785 return -EIO; 801 return -EINVAL;
786 802
787 while (count > 0) { 803 while (count > 0) {
788 ppage = NULL; 804 ppage = NULL;