diff options
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/array.c | 8 | ||||
-rw-r--r-- | fs/proc/proc_misc.c | 111 | ||||
-rw-r--r-- | fs/proc/vmcore.c | 5 |
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 97b4579134d5..7ea52c79b2da 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/blkdev.h> | 46 | #include <linux/blkdev.h> |
47 | #include <linux/hugetlb.h> | 47 | #include <linux/hugetlb.h> |
48 | #include <linux/jiffies.h> | 48 | #include <linux/jiffies.h> |
49 | #include <linux/sysrq.h> | ||
50 | #include <linux/vmalloc.h> | 49 | #include <linux/vmalloc.h> |
51 | #include <linux/crash_dump.h> | 50 | #include <linux/crash_dump.h> |
52 | #include <linux/pid_namespace.h> | 51 | #include <linux/pid_namespace.h> |
@@ -138,6 +137,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
138 | unsigned long allowed; | 137 | unsigned long allowed; |
139 | struct vmalloc_info vmi; | 138 | struct vmalloc_info vmi; |
140 | long cached; | 139 | long cached; |
140 | unsigned long pages[NR_LRU_LISTS]; | ||
141 | int lru; | ||
141 | 142 | ||
142 | /* | 143 | /* |
143 | * display in kilobytes. | 144 | * display in kilobytes. |
@@ -156,51 +157,70 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
156 | 157 | ||
157 | get_vmalloc_info(&vmi); | 158 | get_vmalloc_info(&vmi); |
158 | 159 | ||
160 | for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++) | ||
161 | pages[lru] = global_page_state(NR_LRU_BASE + lru); | ||
162 | |||
159 | /* | 163 | /* |
160 | * Tagged format, for easy grepping and expansion. | 164 | * Tagged format, for easy grepping and expansion. |
161 | */ | 165 | */ |
162 | len = sprintf(page, | 166 | len = sprintf(page, |
163 | "MemTotal: %8lu kB\n" | 167 | "MemTotal: %8lu kB\n" |
164 | "MemFree: %8lu kB\n" | 168 | "MemFree: %8lu kB\n" |
165 | "Buffers: %8lu kB\n" | 169 | "Buffers: %8lu kB\n" |
166 | "Cached: %8lu kB\n" | 170 | "Cached: %8lu kB\n" |
167 | "SwapCached: %8lu kB\n" | 171 | "SwapCached: %8lu kB\n" |
168 | "Active: %8lu kB\n" | 172 | "Active: %8lu kB\n" |
169 | "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 | ||
170 | #ifdef CONFIG_HIGHMEM | 182 | #ifdef CONFIG_HIGHMEM |
171 | "HighTotal: %8lu kB\n" | 183 | "HighTotal: %8lu kB\n" |
172 | "HighFree: %8lu kB\n" | 184 | "HighFree: %8lu kB\n" |
173 | "LowTotal: %8lu kB\n" | 185 | "LowTotal: %8lu kB\n" |
174 | "LowFree: %8lu kB\n" | 186 | "LowFree: %8lu kB\n" |
175 | #endif | 187 | #endif |
176 | "SwapTotal: %8lu kB\n" | 188 | "SwapTotal: %8lu kB\n" |
177 | "SwapFree: %8lu kB\n" | 189 | "SwapFree: %8lu kB\n" |
178 | "Dirty: %8lu kB\n" | 190 | "Dirty: %8lu kB\n" |
179 | "Writeback: %8lu kB\n" | 191 | "Writeback: %8lu kB\n" |
180 | "AnonPages: %8lu kB\n" | 192 | "AnonPages: %8lu kB\n" |
181 | "Mapped: %8lu kB\n" | 193 | "Mapped: %8lu kB\n" |
182 | "Slab: %8lu kB\n" | 194 | "Slab: %8lu kB\n" |
183 | "SReclaimable: %8lu kB\n" | 195 | "SReclaimable: %8lu kB\n" |
184 | "SUnreclaim: %8lu kB\n" | 196 | "SUnreclaim: %8lu kB\n" |
185 | "PageTables: %8lu kB\n" | 197 | "PageTables: %8lu kB\n" |
186 | #ifdef CONFIG_QUICKLIST | 198 | #ifdef CONFIG_QUICKLIST |
187 | "Quicklists: %8lu kB\n" | 199 | "Quicklists: %8lu kB\n" |
188 | #endif | 200 | #endif |
189 | "NFS_Unstable: %8lu kB\n" | 201 | "NFS_Unstable: %8lu kB\n" |
190 | "Bounce: %8lu kB\n" | 202 | "Bounce: %8lu kB\n" |
191 | "WritebackTmp: %8lu kB\n" | 203 | "WritebackTmp: %8lu kB\n" |
192 | "CommitLimit: %8lu kB\n" | 204 | "CommitLimit: %8lu kB\n" |
193 | "Committed_AS: %8lu kB\n" | 205 | "Committed_AS: %8lu kB\n" |
194 | "VmallocTotal: %8lu kB\n" | 206 | "VmallocTotal: %8lu kB\n" |
195 | "VmallocUsed: %8lu kB\n" | 207 | "VmallocUsed: %8lu kB\n" |
196 | "VmallocChunk: %8lu kB\n", | 208 | "VmallocChunk: %8lu kB\n", |
197 | K(i.totalram), | 209 | K(i.totalram), |
198 | K(i.freeram), | 210 | K(i.freeram), |
199 | K(i.bufferram), | 211 | K(i.bufferram), |
200 | K(cached), | 212 | K(cached), |
201 | K(total_swapcache_pages), | 213 | K(total_swapcache_pages), |
202 | K(global_page_state(NR_ACTIVE)), | 214 | K(pages[LRU_ACTIVE_ANON] + pages[LRU_ACTIVE_FILE]), |
203 | 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 | ||
204 | #ifdef CONFIG_HIGHMEM | 224 | #ifdef CONFIG_HIGHMEM |
205 | K(i.totalhigh), | 225 | K(i.totalhigh), |
206 | K(i.freehigh), | 226 | K(i.freehigh), |
@@ -702,28 +722,6 @@ static int execdomains_read_proc(char *page, char **start, off_t off, | |||
702 | return proc_calc_metrics(page, start, off, count, eof, len); | 722 | return proc_calc_metrics(page, start, off, count, eof, len); |
703 | } | 723 | } |
704 | 724 | ||
705 | #ifdef CONFIG_MAGIC_SYSRQ | ||
706 | /* | ||
707 | * writing 'C' to /proc/sysrq-trigger is like sysrq-C | ||
708 | */ | ||
709 | static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf, | ||
710 | size_t count, loff_t *ppos) | ||
711 | { | ||
712 | if (count) { | ||
713 | char c; | ||
714 | |||
715 | if (get_user(c, buf)) | ||
716 | return -EFAULT; | ||
717 | __handle_sysrq(c, NULL, 0); | ||
718 | } | ||
719 | return count; | ||
720 | } | ||
721 | |||
722 | static const struct file_operations proc_sysrq_trigger_operations = { | ||
723 | .write = write_sysrq_trigger, | ||
724 | }; | ||
725 | #endif | ||
726 | |||
727 | #ifdef CONFIG_PROC_PAGE_MONITOR | 725 | #ifdef CONFIG_PROC_PAGE_MONITOR |
728 | #define KPMSIZE sizeof(u64) | 726 | #define KPMSIZE sizeof(u64) |
729 | #define KPMMASK (KPMSIZE - 1) | 727 | #define KPMMASK (KPMSIZE - 1) |
@@ -932,7 +930,4 @@ void __init proc_misc_init(void) | |||
932 | #ifdef CONFIG_PROC_VMCORE | 930 | #ifdef CONFIG_PROC_VMCORE |
933 | proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations); | 931 | proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations); |
934 | #endif | 932 | #endif |
935 | #ifdef CONFIG_MAGIC_SYSRQ | ||
936 | proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations); | ||
937 | #endif | ||
938 | } | 933 | } |
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. */ |
33 | static u64 vmcore_size; | 33 | static u64 vmcore_size; |
34 | 34 | ||
35 | /* Stores the physical address of elf header of crash image. */ | ||
36 | unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; | ||
37 | |||
38 | struct proc_dir_entry *proc_vmcore = NULL; | 35 | struct 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) { |