diff options
Diffstat (limited to 'fs/proc/proc_misc.c')
-rw-r--r-- | fs/proc/proc_misc.c | 111 |
1 files changed, 53 insertions, 58 deletions
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 | */ | ||
711 | static 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 | |||
724 | static 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 | } |