aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/array.c8
-rw-r--r--fs/proc/proc_misc.c111
-rw-r--r--fs/proc/vmcore.c5
3 files changed, 58 insertions, 66 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index f4bc0e789539..bb9f4b05703d 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -388,20 +388,20 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
388 388
389 /* add up live thread stats at the group level */ 389 /* add up live thread stats at the group level */
390 if (whole) { 390 if (whole) {
391 struct task_cputime cputime;
391 struct task_struct *t = task; 392 struct task_struct *t = task;
392 do { 393 do {
393 min_flt += t->min_flt; 394 min_flt += t->min_flt;
394 maj_flt += t->maj_flt; 395 maj_flt += t->maj_flt;
395 utime = cputime_add(utime, task_utime(t));
396 stime = cputime_add(stime, task_stime(t));
397 gtime = cputime_add(gtime, task_gtime(t)); 396 gtime = cputime_add(gtime, task_gtime(t));
398 t = next_thread(t); 397 t = next_thread(t);
399 } while (t != task); 398 } while (t != task);
400 399
401 min_flt += sig->min_flt; 400 min_flt += sig->min_flt;
402 maj_flt += sig->maj_flt; 401 maj_flt += sig->maj_flt;
403 utime = cputime_add(utime, sig->utime); 402 thread_group_cputime(task, &cputime);
404 stime = cputime_add(stime, sig->stime); 403 utime = cputime.utime;
404 stime = cputime.stime;
405 gtime = cputime_add(gtime, sig->gtime); 405 gtime = cputime_add(gtime, sig->gtime);
406 } 406 }
407 407
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index b675a49c1823..61b25f4eabe6 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -45,7 +45,6 @@
45#include <linux/blkdev.h> 45#include <linux/blkdev.h>
46#include <linux/hugetlb.h> 46#include <linux/hugetlb.h>
47#include <linux/jiffies.h> 47#include <linux/jiffies.h>
48#include <linux/sysrq.h>
49#include <linux/vmalloc.h> 48#include <linux/vmalloc.h>
50#include <linux/crash_dump.h> 49#include <linux/crash_dump.h>
51#include <linux/pid_namespace.h> 50#include <linux/pid_namespace.h>
@@ -137,6 +136,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
137 unsigned long allowed; 136 unsigned long allowed;
138 struct vmalloc_info vmi; 137 struct vmalloc_info vmi;
139 long cached; 138 long cached;
139 unsigned long pages[NR_LRU_LISTS];
140 int lru;
140 141
141/* 142/*
142 * display in kilobytes. 143 * display in kilobytes.
@@ -155,51 +156,70 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
155 156
156 get_vmalloc_info(&vmi); 157 get_vmalloc_info(&vmi);
157 158
159 for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++)
160 pages[lru] = global_page_state(NR_LRU_BASE + lru);
161
158 /* 162 /*
159 * Tagged format, for easy grepping and expansion. 163 * Tagged format, for easy grepping and expansion.
160 */ 164 */
161 len = sprintf(page, 165 len = sprintf(page,
162 "MemTotal: %8lu kB\n" 166 "MemTotal: %8lu kB\n"
163 "MemFree: %8lu kB\n" 167 "MemFree: %8lu kB\n"
164 "Buffers: %8lu kB\n" 168 "Buffers: %8lu kB\n"
165 "Cached: %8lu kB\n" 169 "Cached: %8lu kB\n"
166 "SwapCached: %8lu kB\n" 170 "SwapCached: %8lu kB\n"
167 "Active: %8lu kB\n" 171 "Active: %8lu kB\n"
168 "Inactive: %8lu kB\n" 172 "Inactive: %8lu kB\n"
173 "Active(anon): %8lu kB\n"
174 "Inactive(anon): %8lu kB\n"
175 "Active(file): %8lu kB\n"
176 "Inactive(file): %8lu kB\n"
177#ifdef CONFIG_UNEVICTABLE_LRU
178 "Unevictable: %8lu kB\n"
179 "Mlocked: %8lu kB\n"
180#endif
169#ifdef CONFIG_HIGHMEM 181#ifdef CONFIG_HIGHMEM
170 "HighTotal: %8lu kB\n" 182 "HighTotal: %8lu kB\n"
171 "HighFree: %8lu kB\n" 183 "HighFree: %8lu kB\n"
172 "LowTotal: %8lu kB\n" 184 "LowTotal: %8lu kB\n"
173 "LowFree: %8lu kB\n" 185 "LowFree: %8lu kB\n"
174#endif 186#endif
175 "SwapTotal: %8lu kB\n" 187 "SwapTotal: %8lu kB\n"
176 "SwapFree: %8lu kB\n" 188 "SwapFree: %8lu kB\n"
177 "Dirty: %8lu kB\n" 189 "Dirty: %8lu kB\n"
178 "Writeback: %8lu kB\n" 190 "Writeback: %8lu kB\n"
179 "AnonPages: %8lu kB\n" 191 "AnonPages: %8lu kB\n"
180 "Mapped: %8lu kB\n" 192 "Mapped: %8lu kB\n"
181 "Slab: %8lu kB\n" 193 "Slab: %8lu kB\n"
182 "SReclaimable: %8lu kB\n" 194 "SReclaimable: %8lu kB\n"
183 "SUnreclaim: %8lu kB\n" 195 "SUnreclaim: %8lu kB\n"
184 "PageTables: %8lu kB\n" 196 "PageTables: %8lu kB\n"
185#ifdef CONFIG_QUICKLIST 197#ifdef CONFIG_QUICKLIST
186 "Quicklists: %8lu kB\n" 198 "Quicklists: %8lu kB\n"
187#endif 199#endif
188 "NFS_Unstable: %8lu kB\n" 200 "NFS_Unstable: %8lu kB\n"
189 "Bounce: %8lu kB\n" 201 "Bounce: %8lu kB\n"
190 "WritebackTmp: %8lu kB\n" 202 "WritebackTmp: %8lu kB\n"
191 "CommitLimit: %8lu kB\n" 203 "CommitLimit: %8lu kB\n"
192 "Committed_AS: %8lu kB\n" 204 "Committed_AS: %8lu kB\n"
193 "VmallocTotal: %8lu kB\n" 205 "VmallocTotal: %8lu kB\n"
194 "VmallocUsed: %8lu kB\n" 206 "VmallocUsed: %8lu kB\n"
195 "VmallocChunk: %8lu kB\n", 207 "VmallocChunk: %8lu kB\n",
196 K(i.totalram), 208 K(i.totalram),
197 K(i.freeram), 209 K(i.freeram),
198 K(i.bufferram), 210 K(i.bufferram),
199 K(cached), 211 K(cached),
200 K(total_swapcache_pages), 212 K(total_swapcache_pages),
201 K(global_page_state(NR_ACTIVE)), 213 K(pages[LRU_ACTIVE_ANON] + pages[LRU_ACTIVE_FILE]),
202 K(global_page_state(NR_INACTIVE)), 214 K(pages[LRU_INACTIVE_ANON] + pages[LRU_INACTIVE_FILE]),
215 K(pages[LRU_ACTIVE_ANON]),
216 K(pages[LRU_INACTIVE_ANON]),
217 K(pages[LRU_ACTIVE_FILE]),
218 K(pages[LRU_INACTIVE_FILE]),
219#ifdef CONFIG_UNEVICTABLE_LRU
220 K(pages[LRU_UNEVICTABLE]),
221 K(global_page_state(NR_MLOCK)),
222#endif
203#ifdef CONFIG_HIGHMEM 223#ifdef CONFIG_HIGHMEM
204 K(i.totalhigh), 224 K(i.totalhigh),
205 K(i.freehigh), 225 K(i.freehigh),
@@ -704,28 +724,6 @@ static int execdomains_read_proc(char *page, char **start, off_t off,
704 return proc_calc_metrics(page, start, off, count, eof, len); 724 return proc_calc_metrics(page, start, off, count, eof, len);
705} 725}
706 726
707#ifdef CONFIG_MAGIC_SYSRQ
708/*
709 * writing 'C' to /proc/sysrq-trigger is like sysrq-C
710 */
711static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
712 size_t count, loff_t *ppos)
713{
714 if (count) {
715 char c;
716
717 if (get_user(c, buf))
718 return -EFAULT;
719 __handle_sysrq(c, NULL, 0);
720 }
721 return count;
722}
723
724static const struct file_operations proc_sysrq_trigger_operations = {
725 .write = write_sysrq_trigger,
726};
727#endif
728
729#ifdef CONFIG_PROC_PAGE_MONITOR 727#ifdef CONFIG_PROC_PAGE_MONITOR
730#define KPMSIZE sizeof(u64) 728#define KPMSIZE sizeof(u64)
731#define KPMMASK (KPMSIZE - 1) 729#define KPMMASK (KPMSIZE - 1)
@@ -934,7 +932,4 @@ void __init proc_misc_init(void)
934#ifdef CONFIG_PROC_VMCORE 932#ifdef CONFIG_PROC_VMCORE
935 proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations); 933 proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations);
936#endif 934#endif
937#ifdef CONFIG_MAGIC_SYSRQ
938 proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations);
939#endif
940} 935}
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
index 841368b87a29..cd9ca67f841b 100644
--- a/fs/proc/vmcore.c
+++ b/fs/proc/vmcore.c
@@ -32,9 +32,6 @@ static size_t elfcorebuf_sz;
32/* Total size of vmcore file. */ 32/* Total size of vmcore file. */
33static u64 vmcore_size; 33static u64 vmcore_size;
34 34
35/* Stores the physical address of elf header of crash image. */
36unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
37
38struct proc_dir_entry *proc_vmcore = NULL; 35struct proc_dir_entry *proc_vmcore = NULL;
39 36
40/* Reads a page from the oldmem device from given offset. */ 37/* Reads a page from the oldmem device from given offset. */
@@ -647,7 +644,7 @@ static int __init vmcore_init(void)
647 int rc = 0; 644 int rc = 0;
648 645
649 /* If elfcorehdr= has been passed in cmdline, then capture the dump.*/ 646 /* If elfcorehdr= has been passed in cmdline, then capture the dump.*/
650 if (!(elfcorehdr_addr < ELFCORE_ADDR_MAX)) 647 if (!(is_vmcore_usable()))
651 return rc; 648 return rc;
652 rc = parse_crash_elf_headers(); 649 rc = parse_crash_elf_headers();
653 if (rc) { 650 if (rc) {