diff options
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/Kconfig | 6 | ||||
-rw-r--r-- | fs/proc/Makefile | 2 | ||||
-rw-r--r-- | fs/proc/array.c | 31 | ||||
-rw-r--r-- | fs/proc/base.c | 57 | ||||
-rw-r--r-- | fs/proc/consoles.c (renamed from fs/proc/proc_console.c) | 8 | ||||
-rw-r--r-- | fs/proc/devices.c | 4 | ||||
-rw-r--r-- | fs/proc/generic.c | 17 | ||||
-rw-r--r-- | fs/proc/inode.c | 7 | ||||
-rw-r--r-- | fs/proc/internal.h | 5 | ||||
-rw-r--r-- | fs/proc/kcore.c | 2 | ||||
-rw-r--r-- | fs/proc/meminfo.c | 14 | ||||
-rw-r--r-- | fs/proc/page.c | 16 | ||||
-rw-r--r-- | fs/proc/proc_devtree.c | 2 | ||||
-rw-r--r-- | fs/proc/proc_tty.c | 26 | ||||
-rw-r--r-- | fs/proc/softirqs.c | 6 | ||||
-rw-r--r-- | fs/proc/stat.c | 2 | ||||
-rw-r--r-- | fs/proc/task_mmu.c | 12 | ||||
-rw-r--r-- | fs/proc/task_nommu.c | 7 |
18 files changed, 101 insertions, 123 deletions
diff --git a/fs/proc/Kconfig b/fs/proc/Kconfig index 6a0068841d96..15af6222f8a4 100644 --- a/fs/proc/Kconfig +++ b/fs/proc/Kconfig | |||
@@ -1,5 +1,5 @@ | |||
1 | config PROC_FS | 1 | config PROC_FS |
2 | bool "/proc file system support" if EMBEDDED | 2 | bool "/proc file system support" if EXPERT |
3 | default y | 3 | default y |
4 | help | 4 | help |
5 | This is a virtual file system providing information about the status | 5 | This is a virtual file system providing information about the status |
@@ -40,7 +40,7 @@ config PROC_VMCORE | |||
40 | Exports the dump image of crashed kernel in ELF format. | 40 | Exports the dump image of crashed kernel in ELF format. |
41 | 41 | ||
42 | config PROC_SYSCTL | 42 | config PROC_SYSCTL |
43 | bool "Sysctl support (/proc/sys)" if EMBEDDED | 43 | bool "Sysctl support (/proc/sys)" if EXPERT |
44 | depends on PROC_FS | 44 | depends on PROC_FS |
45 | select SYSCTL | 45 | select SYSCTL |
46 | default y | 46 | default y |
@@ -61,7 +61,7 @@ config PROC_SYSCTL | |||
61 | config PROC_PAGE_MONITOR | 61 | config PROC_PAGE_MONITOR |
62 | default y | 62 | default y |
63 | depends on PROC_FS && MMU | 63 | depends on PROC_FS && MMU |
64 | bool "Enable /proc page monitoring" if EMBEDDED | 64 | bool "Enable /proc page monitoring" if EXPERT |
65 | help | 65 | help |
66 | Various /proc files exist to monitor process memory utilization: | 66 | Various /proc files exist to monitor process memory utilization: |
67 | /proc/pid/smaps, /proc/pid/clear_refs, /proc/pid/pagemap, | 67 | /proc/pid/smaps, /proc/pid/clear_refs, /proc/pid/pagemap, |
diff --git a/fs/proc/Makefile b/fs/proc/Makefile index 288a49e098bf..df434c5f28fb 100644 --- a/fs/proc/Makefile +++ b/fs/proc/Makefile | |||
@@ -10,12 +10,12 @@ proc-$(CONFIG_MMU) := mmu.o task_mmu.o | |||
10 | proc-y += inode.o root.o base.o generic.o array.o \ | 10 | proc-y += inode.o root.o base.o generic.o array.o \ |
11 | proc_tty.o | 11 | proc_tty.o |
12 | proc-y += cmdline.o | 12 | proc-y += cmdline.o |
13 | proc-y += consoles.o | ||
13 | proc-y += cpuinfo.o | 14 | proc-y += cpuinfo.o |
14 | proc-y += devices.o | 15 | proc-y += devices.o |
15 | proc-y += interrupts.o | 16 | proc-y += interrupts.o |
16 | proc-y += loadavg.o | 17 | proc-y += loadavg.o |
17 | proc-y += meminfo.o | 18 | proc-y += meminfo.o |
18 | proc-y += proc_console.o | ||
19 | proc-y += stat.o | 19 | proc-y += stat.o |
20 | proc-y += uptime.o | 20 | proc-y += uptime.o |
21 | proc-y += version.o | 21 | proc-y += version.o |
diff --git a/fs/proc/array.c b/fs/proc/array.c index fff6572676ae..7c99c1cf7e5c 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -95,7 +95,7 @@ static inline void task_name(struct seq_file *m, struct task_struct *p) | |||
95 | 95 | ||
96 | get_task_comm(tcomm, p); | 96 | get_task_comm(tcomm, p); |
97 | 97 | ||
98 | seq_printf(m, "Name:\t"); | 98 | seq_puts(m, "Name:\t"); |
99 | end = m->buf + m->size; | 99 | end = m->buf + m->size; |
100 | buf = m->buf + m->count; | 100 | buf = m->buf + m->count; |
101 | name = tcomm; | 101 | name = tcomm; |
@@ -122,7 +122,7 @@ static inline void task_name(struct seq_file *m, struct task_struct *p) | |||
122 | buf++; | 122 | buf++; |
123 | } | 123 | } |
124 | m->count = buf - m->buf; | 124 | m->count = buf - m->buf; |
125 | seq_printf(m, "\n"); | 125 | seq_putc(m, '\n'); |
126 | } | 126 | } |
127 | 127 | ||
128 | /* | 128 | /* |
@@ -208,7 +208,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | |||
208 | seq_printf(m, "%d ", GROUP_AT(group_info, g)); | 208 | seq_printf(m, "%d ", GROUP_AT(group_info, g)); |
209 | put_cred(cred); | 209 | put_cred(cred); |
210 | 210 | ||
211 | seq_printf(m, "\n"); | 211 | seq_putc(m, '\n'); |
212 | } | 212 | } |
213 | 213 | ||
214 | static void render_sigset_t(struct seq_file *m, const char *header, | 214 | static void render_sigset_t(struct seq_file *m, const char *header, |
@@ -216,7 +216,7 @@ static void render_sigset_t(struct seq_file *m, const char *header, | |||
216 | { | 216 | { |
217 | int i; | 217 | int i; |
218 | 218 | ||
219 | seq_printf(m, "%s", header); | 219 | seq_puts(m, header); |
220 | 220 | ||
221 | i = _NSIG; | 221 | i = _NSIG; |
222 | do { | 222 | do { |
@@ -230,7 +230,7 @@ static void render_sigset_t(struct seq_file *m, const char *header, | |||
230 | seq_printf(m, "%x", x); | 230 | seq_printf(m, "%x", x); |
231 | } while (i >= 4); | 231 | } while (i >= 4); |
232 | 232 | ||
233 | seq_printf(m, "\n"); | 233 | seq_putc(m, '\n'); |
234 | } | 234 | } |
235 | 235 | ||
236 | static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign, | 236 | static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign, |
@@ -291,12 +291,12 @@ static void render_cap_t(struct seq_file *m, const char *header, | |||
291 | { | 291 | { |
292 | unsigned __capi; | 292 | unsigned __capi; |
293 | 293 | ||
294 | seq_printf(m, "%s", header); | 294 | seq_puts(m, header); |
295 | CAP_FOR_EACH_U32(__capi) { | 295 | CAP_FOR_EACH_U32(__capi) { |
296 | seq_printf(m, "%08x", | 296 | seq_printf(m, "%08x", |
297 | a->cap[(_KERNEL_CAPABILITY_U32S-1) - __capi]); | 297 | a->cap[(_KERNEL_CAPABILITY_U32S-1) - __capi]); |
298 | } | 298 | } |
299 | seq_printf(m, "\n"); | 299 | seq_putc(m, '\n'); |
300 | } | 300 | } |
301 | 301 | ||
302 | static inline void task_cap(struct seq_file *m, struct task_struct *p) | 302 | static inline void task_cap(struct seq_file *m, struct task_struct *p) |
@@ -329,12 +329,12 @@ static inline void task_context_switch_counts(struct seq_file *m, | |||
329 | 329 | ||
330 | static void task_cpus_allowed(struct seq_file *m, struct task_struct *task) | 330 | static void task_cpus_allowed(struct seq_file *m, struct task_struct *task) |
331 | { | 331 | { |
332 | seq_printf(m, "Cpus_allowed:\t"); | 332 | seq_puts(m, "Cpus_allowed:\t"); |
333 | seq_cpumask(m, &task->cpus_allowed); | 333 | seq_cpumask(m, &task->cpus_allowed); |
334 | seq_printf(m, "\n"); | 334 | seq_putc(m, '\n'); |
335 | seq_printf(m, "Cpus_allowed_list:\t"); | 335 | seq_puts(m, "Cpus_allowed_list:\t"); |
336 | seq_cpumask_list(m, &task->cpus_allowed); | 336 | seq_cpumask_list(m, &task->cpus_allowed); |
337 | seq_printf(m, "\n"); | 337 | seq_putc(m, '\n'); |
338 | } | 338 | } |
339 | 339 | ||
340 | int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, | 340 | int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, |
@@ -353,9 +353,6 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, | |||
353 | task_cap(m, task); | 353 | task_cap(m, task); |
354 | task_cpus_allowed(m, task); | 354 | task_cpus_allowed(m, task); |
355 | cpuset_task_status_allowed(m, task); | 355 | cpuset_task_status_allowed(m, task); |
356 | #if defined(CONFIG_S390) | ||
357 | task_show_regs(m, task); | ||
358 | #endif | ||
359 | task_context_switch_counts(m, task); | 356 | task_context_switch_counts(m, task); |
360 | return 0; | 357 | return 0; |
361 | } | 358 | } |
@@ -535,15 +532,15 @@ int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns, | |||
535 | int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns, | 532 | int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns, |
536 | struct pid *pid, struct task_struct *task) | 533 | struct pid *pid, struct task_struct *task) |
537 | { | 534 | { |
538 | int size = 0, resident = 0, shared = 0, text = 0, lib = 0, data = 0; | 535 | unsigned long size = 0, resident = 0, shared = 0, text = 0, data = 0; |
539 | struct mm_struct *mm = get_task_mm(task); | 536 | struct mm_struct *mm = get_task_mm(task); |
540 | 537 | ||
541 | if (mm) { | 538 | if (mm) { |
542 | size = task_statm(mm, &shared, &text, &data, &resident); | 539 | size = task_statm(mm, &shared, &text, &data, &resident); |
543 | mmput(mm); | 540 | mmput(mm); |
544 | } | 541 | } |
545 | seq_printf(m, "%d %d %d %d %d %d %d\n", | 542 | seq_printf(m, "%lu %lu %lu %lu 0 %lu 0\n", |
546 | size, resident, shared, text, lib, data, 0); | 543 | size, resident, shared, text, data); |
547 | 544 | ||
548 | return 0; | 545 | return 0; |
549 | } | 546 | } |
diff --git a/fs/proc/base.c b/fs/proc/base.c index b20962c71a52..9d096e82b201 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -373,26 +373,20 @@ static int lstats_show_proc(struct seq_file *m, void *v) | |||
373 | return -ESRCH; | 373 | return -ESRCH; |
374 | seq_puts(m, "Latency Top version : v0.1\n"); | 374 | seq_puts(m, "Latency Top version : v0.1\n"); |
375 | for (i = 0; i < 32; i++) { | 375 | for (i = 0; i < 32; i++) { |
376 | if (task->latency_record[i].backtrace[0]) { | 376 | struct latency_record *lr = &task->latency_record[i]; |
377 | if (lr->backtrace[0]) { | ||
377 | int q; | 378 | int q; |
378 | seq_printf(m, "%i %li %li ", | 379 | seq_printf(m, "%i %li %li", |
379 | task->latency_record[i].count, | 380 | lr->count, lr->time, lr->max); |
380 | task->latency_record[i].time, | ||
381 | task->latency_record[i].max); | ||
382 | for (q = 0; q < LT_BACKTRACEDEPTH; q++) { | 381 | for (q = 0; q < LT_BACKTRACEDEPTH; q++) { |
383 | char sym[KSYM_SYMBOL_LEN]; | 382 | unsigned long bt = lr->backtrace[q]; |
384 | char *c; | 383 | if (!bt) |
385 | if (!task->latency_record[i].backtrace[q]) | ||
386 | break; | 384 | break; |
387 | if (task->latency_record[i].backtrace[q] == ULONG_MAX) | 385 | if (bt == ULONG_MAX) |
388 | break; | 386 | break; |
389 | sprint_symbol(sym, task->latency_record[i].backtrace[q]); | 387 | seq_printf(m, " %ps", (void *)bt); |
390 | c = strchr(sym, '+'); | ||
391 | if (c) | ||
392 | *c = 0; | ||
393 | seq_printf(m, "%s ", sym); | ||
394 | } | 388 | } |
395 | seq_printf(m, "\n"); | 389 | seq_putc(m, '\n'); |
396 | } | 390 | } |
397 | 391 | ||
398 | } | 392 | } |
@@ -751,14 +745,7 @@ static int proc_single_show(struct seq_file *m, void *v) | |||
751 | 745 | ||
752 | static int proc_single_open(struct inode *inode, struct file *filp) | 746 | static int proc_single_open(struct inode *inode, struct file *filp) |
753 | { | 747 | { |
754 | int ret; | 748 | return single_open(filp, proc_single_show, inode); |
755 | ret = single_open(filp, proc_single_show, NULL); | ||
756 | if (!ret) { | ||
757 | struct seq_file *m = filp->private_data; | ||
758 | |||
759 | m->private = inode; | ||
760 | } | ||
761 | return ret; | ||
762 | } | 749 | } |
763 | 750 | ||
764 | static const struct file_operations proc_single_file_operations = { | 751 | static const struct file_operations proc_single_file_operations = { |
@@ -1164,7 +1151,7 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf, | |||
1164 | goto err_task_lock; | 1151 | goto err_task_lock; |
1165 | } | 1152 | } |
1166 | 1153 | ||
1167 | if (oom_score_adj < task->signal->oom_score_adj && | 1154 | if (oom_score_adj < task->signal->oom_score_adj_min && |
1168 | !capable(CAP_SYS_RESOURCE)) { | 1155 | !capable(CAP_SYS_RESOURCE)) { |
1169 | err = -EACCES; | 1156 | err = -EACCES; |
1170 | goto err_sighand; | 1157 | goto err_sighand; |
@@ -1177,6 +1164,8 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf, | |||
1177 | atomic_dec(&task->mm->oom_disable_count); | 1164 | atomic_dec(&task->mm->oom_disable_count); |
1178 | } | 1165 | } |
1179 | task->signal->oom_score_adj = oom_score_adj; | 1166 | task->signal->oom_score_adj = oom_score_adj; |
1167 | if (has_capability_noaudit(current, CAP_SYS_RESOURCE)) | ||
1168 | task->signal->oom_score_adj_min = oom_score_adj; | ||
1180 | /* | 1169 | /* |
1181 | * Scale /proc/pid/oom_adj appropriately ensuring that OOM_DISABLE is | 1170 | * Scale /proc/pid/oom_adj appropriately ensuring that OOM_DISABLE is |
1182 | * always attainable. | 1171 | * always attainable. |
@@ -1386,15 +1375,7 @@ sched_write(struct file *file, const char __user *buf, | |||
1386 | 1375 | ||
1387 | static int sched_open(struct inode *inode, struct file *filp) | 1376 | static int sched_open(struct inode *inode, struct file *filp) |
1388 | { | 1377 | { |
1389 | int ret; | 1378 | return single_open(filp, sched_show, inode); |
1390 | |||
1391 | ret = single_open(filp, sched_show, NULL); | ||
1392 | if (!ret) { | ||
1393 | struct seq_file *m = filp->private_data; | ||
1394 | |||
1395 | m->private = inode; | ||
1396 | } | ||
1397 | return ret; | ||
1398 | } | 1379 | } |
1399 | 1380 | ||
1400 | static const struct file_operations proc_pid_sched_operations = { | 1381 | static const struct file_operations proc_pid_sched_operations = { |
@@ -1530,15 +1511,7 @@ static int comm_show(struct seq_file *m, void *v) | |||
1530 | 1511 | ||
1531 | static int comm_open(struct inode *inode, struct file *filp) | 1512 | static int comm_open(struct inode *inode, struct file *filp) |
1532 | { | 1513 | { |
1533 | int ret; | 1514 | return single_open(filp, comm_show, inode); |
1534 | |||
1535 | ret = single_open(filp, comm_show, NULL); | ||
1536 | if (!ret) { | ||
1537 | struct seq_file *m = filp->private_data; | ||
1538 | |||
1539 | m->private = inode; | ||
1540 | } | ||
1541 | return ret; | ||
1542 | } | 1515 | } |
1543 | 1516 | ||
1544 | static const struct file_operations proc_pid_set_comm_operations = { | 1517 | static const struct file_operations proc_pid_set_comm_operations = { |
diff --git a/fs/proc/proc_console.c b/fs/proc/consoles.c index 8a707609f528..b701eaa482bf 100644 --- a/fs/proc/proc_console.c +++ b/fs/proc/consoles.c | |||
@@ -67,7 +67,7 @@ static void *c_start(struct seq_file *m, loff_t *pos) | |||
67 | struct console *con; | 67 | struct console *con; |
68 | loff_t off = 0; | 68 | loff_t off = 0; |
69 | 69 | ||
70 | acquire_console_sem(); | 70 | console_lock(); |
71 | for_each_console(con) | 71 | for_each_console(con) |
72 | if (off++ == *pos) | 72 | if (off++ == *pos) |
73 | break; | 73 | break; |
@@ -84,7 +84,7 @@ static void *c_next(struct seq_file *m, void *v, loff_t *pos) | |||
84 | 84 | ||
85 | static void c_stop(struct seq_file *m, void *v) | 85 | static void c_stop(struct seq_file *m, void *v) |
86 | { | 86 | { |
87 | release_console_sem(); | 87 | console_unlock(); |
88 | } | 88 | } |
89 | 89 | ||
90 | static const struct seq_operations consoles_op = { | 90 | static const struct seq_operations consoles_op = { |
@@ -106,9 +106,9 @@ static const struct file_operations proc_consoles_operations = { | |||
106 | .release = seq_release, | 106 | .release = seq_release, |
107 | }; | 107 | }; |
108 | 108 | ||
109 | static int register_proc_consoles(void) | 109 | static int __init proc_consoles_init(void) |
110 | { | 110 | { |
111 | proc_create("consoles", 0, NULL, &proc_consoles_operations); | 111 | proc_create("consoles", 0, NULL, &proc_consoles_operations); |
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | module_init(register_proc_consoles); | 114 | module_init(proc_consoles_init); |
diff --git a/fs/proc/devices.c b/fs/proc/devices.c index 59ee7da959c9..b14347167c35 100644 --- a/fs/proc/devices.c +++ b/fs/proc/devices.c | |||
@@ -9,14 +9,14 @@ static int devinfo_show(struct seq_file *f, void *v) | |||
9 | 9 | ||
10 | if (i < CHRDEV_MAJOR_HASH_SIZE) { | 10 | if (i < CHRDEV_MAJOR_HASH_SIZE) { |
11 | if (i == 0) | 11 | if (i == 0) |
12 | seq_printf(f, "Character devices:\n"); | 12 | seq_puts(f, "Character devices:\n"); |
13 | chrdev_show(f, i); | 13 | chrdev_show(f, i); |
14 | } | 14 | } |
15 | #ifdef CONFIG_BLOCK | 15 | #ifdef CONFIG_BLOCK |
16 | else { | 16 | else { |
17 | i -= CHRDEV_MAJOR_HASH_SIZE; | 17 | i -= CHRDEV_MAJOR_HASH_SIZE; |
18 | if (i == 0) | 18 | if (i == 0) |
19 | seq_printf(f, "\nBlock devices:\n"); | 19 | seq_puts(f, "\nBlock devices:\n"); |
20 | blkdev_show(f, i); | 20 | blkdev_show(f, i); |
21 | } | 21 | } |
22 | #endif | 22 | #endif |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index f766be29d2c7..01e07f2a188f 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -425,13 +425,10 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, | |||
425 | if (de->namelen != dentry->d_name.len) | 425 | if (de->namelen != dentry->d_name.len) |
426 | continue; | 426 | continue; |
427 | if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { | 427 | if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { |
428 | unsigned int ino; | ||
429 | |||
430 | ino = de->low_ino; | ||
431 | pde_get(de); | 428 | pde_get(de); |
432 | spin_unlock(&proc_subdir_lock); | 429 | spin_unlock(&proc_subdir_lock); |
433 | error = -EINVAL; | 430 | error = -EINVAL; |
434 | inode = proc_get_inode(dir->i_sb, ino, de); | 431 | inode = proc_get_inode(dir->i_sb, de); |
435 | goto out_unlock; | 432 | goto out_unlock; |
436 | } | 433 | } |
437 | } | 434 | } |
@@ -768,12 +765,7 @@ EXPORT_SYMBOL(proc_create_data); | |||
768 | 765 | ||
769 | static void free_proc_entry(struct proc_dir_entry *de) | 766 | static void free_proc_entry(struct proc_dir_entry *de) |
770 | { | 767 | { |
771 | unsigned int ino = de->low_ino; | 768 | release_inode_number(de->low_ino); |
772 | |||
773 | if (ino < PROC_DYNAMIC_FIRST) | ||
774 | return; | ||
775 | |||
776 | release_inode_number(ino); | ||
777 | 769 | ||
778 | if (S_ISLNK(de->mode)) | 770 | if (S_ISLNK(de->mode)) |
779 | kfree(de->data); | 771 | kfree(de->data); |
@@ -834,12 +826,9 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent) | |||
834 | 826 | ||
835 | wait_for_completion(de->pde_unload_completion); | 827 | wait_for_completion(de->pde_unload_completion); |
836 | 828 | ||
837 | goto continue_removing; | 829 | spin_lock(&de->pde_unload_lock); |
838 | } | 830 | } |
839 | spin_unlock(&de->pde_unload_lock); | ||
840 | 831 | ||
841 | continue_removing: | ||
842 | spin_lock(&de->pde_unload_lock); | ||
843 | while (!list_empty(&de->pde_openers)) { | 832 | while (!list_empty(&de->pde_openers)) { |
844 | struct pde_opener *pdeo; | 833 | struct pde_opener *pdeo; |
845 | 834 | ||
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 6bcb926b101b..176ce4cda68a 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -416,12 +416,11 @@ static const struct file_operations proc_reg_file_ops_no_compat = { | |||
416 | }; | 416 | }; |
417 | #endif | 417 | #endif |
418 | 418 | ||
419 | struct inode *proc_get_inode(struct super_block *sb, unsigned int ino, | 419 | struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) |
420 | struct proc_dir_entry *de) | ||
421 | { | 420 | { |
422 | struct inode * inode; | 421 | struct inode * inode; |
423 | 422 | ||
424 | inode = iget_locked(sb, ino); | 423 | inode = iget_locked(sb, de->low_ino); |
425 | if (!inode) | 424 | if (!inode) |
426 | return NULL; | 425 | return NULL; |
427 | if (inode->i_state & I_NEW) { | 426 | if (inode->i_state & I_NEW) { |
@@ -471,7 +470,7 @@ int proc_fill_super(struct super_block *s) | |||
471 | s->s_time_gran = 1; | 470 | s->s_time_gran = 1; |
472 | 471 | ||
473 | pde_get(&proc_root); | 472 | pde_get(&proc_root); |
474 | root_inode = proc_get_inode(s, PROC_ROOT_INO, &proc_root); | 473 | root_inode = proc_get_inode(s, &proc_root); |
475 | if (!root_inode) | 474 | if (!root_inode) |
476 | goto out_no_root; | 475 | goto out_no_root; |
477 | root_inode->i_uid = 0; | 476 | root_inode->i_uid = 0; |
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 1f24a3eddd12..9ad561ded409 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -96,7 +96,8 @@ extern spinlock_t proc_subdir_lock; | |||
96 | struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *); | 96 | struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *); |
97 | int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); | 97 | int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); |
98 | unsigned long task_vsize(struct mm_struct *); | 98 | unsigned long task_vsize(struct mm_struct *); |
99 | int task_statm(struct mm_struct *, int *, int *, int *, int *); | 99 | unsigned long task_statm(struct mm_struct *, |
100 | unsigned long *, unsigned long *, unsigned long *, unsigned long *); | ||
100 | void task_mem(struct seq_file *, struct mm_struct *); | 101 | void task_mem(struct seq_file *, struct mm_struct *); |
101 | 102 | ||
102 | static inline struct proc_dir_entry *pde_get(struct proc_dir_entry *pde) | 103 | static inline struct proc_dir_entry *pde_get(struct proc_dir_entry *pde) |
@@ -108,7 +109,7 @@ void pde_put(struct proc_dir_entry *pde); | |||
108 | 109 | ||
109 | extern struct vfsmount *proc_mnt; | 110 | extern struct vfsmount *proc_mnt; |
110 | int proc_fill_super(struct super_block *); | 111 | int proc_fill_super(struct super_block *); |
111 | struct inode *proc_get_inode(struct super_block *, unsigned int, struct proc_dir_entry *); | 112 | struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *); |
112 | 113 | ||
113 | /* | 114 | /* |
114 | * These are generic /proc routines that use the internal | 115 | * These are generic /proc routines that use the internal |
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 6f37c391468d..d245cb23dd72 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -558,7 +558,7 @@ static int open_kcore(struct inode *inode, struct file *filp) | |||
558 | static const struct file_operations proc_kcore_operations = { | 558 | static const struct file_operations proc_kcore_operations = { |
559 | .read = read_kcore, | 559 | .read = read_kcore, |
560 | .open = open_kcore, | 560 | .open = open_kcore, |
561 | .llseek = generic_file_llseek, | 561 | .llseek = default_llseek, |
562 | }; | 562 | }; |
563 | 563 | ||
564 | #ifdef CONFIG_MEMORY_HOTPLUG | 564 | #ifdef CONFIG_MEMORY_HOTPLUG |
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index a65239cfd97e..ed257d141568 100644 --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c | |||
@@ -101,6 +101,9 @@ static int meminfo_proc_show(struct seq_file *m, void *v) | |||
101 | #ifdef CONFIG_MEMORY_FAILURE | 101 | #ifdef CONFIG_MEMORY_FAILURE |
102 | "HardwareCorrupted: %5lu kB\n" | 102 | "HardwareCorrupted: %5lu kB\n" |
103 | #endif | 103 | #endif |
104 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
105 | "AnonHugePages: %8lu kB\n" | ||
106 | #endif | ||
104 | , | 107 | , |
105 | K(i.totalram), | 108 | K(i.totalram), |
106 | K(i.freeram), | 109 | K(i.freeram), |
@@ -128,7 +131,12 @@ static int meminfo_proc_show(struct seq_file *m, void *v) | |||
128 | K(i.freeswap), | 131 | K(i.freeswap), |
129 | K(global_page_state(NR_FILE_DIRTY)), | 132 | K(global_page_state(NR_FILE_DIRTY)), |
130 | K(global_page_state(NR_WRITEBACK)), | 133 | K(global_page_state(NR_WRITEBACK)), |
131 | K(global_page_state(NR_ANON_PAGES)), | 134 | K(global_page_state(NR_ANON_PAGES) |
135 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
136 | + global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) * | ||
137 | HPAGE_PMD_NR | ||
138 | #endif | ||
139 | ), | ||
132 | K(global_page_state(NR_FILE_MAPPED)), | 140 | K(global_page_state(NR_FILE_MAPPED)), |
133 | K(global_page_state(NR_SHMEM)), | 141 | K(global_page_state(NR_SHMEM)), |
134 | K(global_page_state(NR_SLAB_RECLAIMABLE) + | 142 | K(global_page_state(NR_SLAB_RECLAIMABLE) + |
@@ -151,6 +159,10 @@ static int meminfo_proc_show(struct seq_file *m, void *v) | |||
151 | #ifdef CONFIG_MEMORY_FAILURE | 159 | #ifdef CONFIG_MEMORY_FAILURE |
152 | ,atomic_long_read(&mce_bad_pages) << (PAGE_SHIFT - 10) | 160 | ,atomic_long_read(&mce_bad_pages) << (PAGE_SHIFT - 10) |
153 | #endif | 161 | #endif |
162 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
163 | ,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) * | ||
164 | HPAGE_PMD_NR) | ||
165 | #endif | ||
154 | ); | 166 | ); |
155 | 167 | ||
156 | hugetlb_report_meminfo(m); | 168 | hugetlb_report_meminfo(m); |
diff --git a/fs/proc/page.c b/fs/proc/page.c index 3b8b45660331..6d8e6a9e93ab 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c | |||
@@ -40,7 +40,7 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf, | |||
40 | ppage = pfn_to_page(pfn); | 40 | ppage = pfn_to_page(pfn); |
41 | else | 41 | else |
42 | ppage = NULL; | 42 | ppage = NULL; |
43 | if (!ppage) | 43 | if (!ppage || PageSlab(ppage)) |
44 | pcount = 0; | 44 | pcount = 0; |
45 | else | 45 | else |
46 | pcount = page_mapcount(ppage); | 46 | pcount = page_mapcount(ppage); |
@@ -116,15 +116,17 @@ u64 stable_page_flags(struct page *page) | |||
116 | if (PageHuge(page)) | 116 | if (PageHuge(page)) |
117 | u |= 1 << KPF_HUGE; | 117 | u |= 1 << KPF_HUGE; |
118 | 118 | ||
119 | u |= kpf_copy_bit(k, KPF_LOCKED, PG_locked); | ||
120 | |||
121 | /* | 119 | /* |
122 | * Caveats on high order pages: | 120 | * Caveats on high order pages: page->_count will only be set |
123 | * PG_buddy will only be set on the head page; SLUB/SLQB do the same | 121 | * -1 on the head page; SLUB/SLQB do the same for PG_slab; |
124 | * for PG_slab; SLOB won't set PG_slab at all on compound pages. | 122 | * SLOB won't set PG_slab at all on compound pages. |
125 | */ | 123 | */ |
124 | if (PageBuddy(page)) | ||
125 | u |= 1 << KPF_BUDDY; | ||
126 | |||
127 | u |= kpf_copy_bit(k, KPF_LOCKED, PG_locked); | ||
128 | |||
126 | u |= kpf_copy_bit(k, KPF_SLAB, PG_slab); | 129 | u |= kpf_copy_bit(k, KPF_SLAB, PG_slab); |
127 | u |= kpf_copy_bit(k, KPF_BUDDY, PG_buddy); | ||
128 | 130 | ||
129 | u |= kpf_copy_bit(k, KPF_ERROR, PG_error); | 131 | u |= kpf_copy_bit(k, KPF_ERROR, PG_error); |
130 | u |= kpf_copy_bit(k, KPF_DIRTY, PG_dirty); | 132 | u |= kpf_copy_bit(k, KPF_DIRTY, PG_dirty); |
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c index d9396a4fc7ff..927cbd115e53 100644 --- a/fs/proc/proc_devtree.c +++ b/fs/proc/proc_devtree.c | |||
@@ -233,7 +233,7 @@ void __init proc_device_tree_init(void) | |||
233 | return; | 233 | return; |
234 | root = of_find_node_by_path("/"); | 234 | root = of_find_node_by_path("/"); |
235 | if (root == NULL) { | 235 | if (root == NULL) { |
236 | printk(KERN_ERR "/proc/device-tree: can't find root\n"); | 236 | pr_debug("/proc/device-tree: can't find root\n"); |
237 | return; | 237 | return; |
238 | } | 238 | } |
239 | proc_device_tree_add_node(root, proc_device_tree); | 239 | proc_device_tree_add_node(root, proc_device_tree); |
diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c index 83adcc869437..cb761f010300 100644 --- a/fs/proc/proc_tty.c +++ b/fs/proc/proc_tty.c | |||
@@ -36,27 +36,27 @@ static void show_tty_range(struct seq_file *m, struct tty_driver *p, | |||
36 | } | 36 | } |
37 | switch (p->type) { | 37 | switch (p->type) { |
38 | case TTY_DRIVER_TYPE_SYSTEM: | 38 | case TTY_DRIVER_TYPE_SYSTEM: |
39 | seq_printf(m, "system"); | 39 | seq_puts(m, "system"); |
40 | if (p->subtype == SYSTEM_TYPE_TTY) | 40 | if (p->subtype == SYSTEM_TYPE_TTY) |
41 | seq_printf(m, ":/dev/tty"); | 41 | seq_puts(m, ":/dev/tty"); |
42 | else if (p->subtype == SYSTEM_TYPE_SYSCONS) | 42 | else if (p->subtype == SYSTEM_TYPE_SYSCONS) |
43 | seq_printf(m, ":console"); | 43 | seq_puts(m, ":console"); |
44 | else if (p->subtype == SYSTEM_TYPE_CONSOLE) | 44 | else if (p->subtype == SYSTEM_TYPE_CONSOLE) |
45 | seq_printf(m, ":vtmaster"); | 45 | seq_puts(m, ":vtmaster"); |
46 | break; | 46 | break; |
47 | case TTY_DRIVER_TYPE_CONSOLE: | 47 | case TTY_DRIVER_TYPE_CONSOLE: |
48 | seq_printf(m, "console"); | 48 | seq_puts(m, "console"); |
49 | break; | 49 | break; |
50 | case TTY_DRIVER_TYPE_SERIAL: | 50 | case TTY_DRIVER_TYPE_SERIAL: |
51 | seq_printf(m, "serial"); | 51 | seq_puts(m, "serial"); |
52 | break; | 52 | break; |
53 | case TTY_DRIVER_TYPE_PTY: | 53 | case TTY_DRIVER_TYPE_PTY: |
54 | if (p->subtype == PTY_TYPE_MASTER) | 54 | if (p->subtype == PTY_TYPE_MASTER) |
55 | seq_printf(m, "pty:master"); | 55 | seq_puts(m, "pty:master"); |
56 | else if (p->subtype == PTY_TYPE_SLAVE) | 56 | else if (p->subtype == PTY_TYPE_SLAVE) |
57 | seq_printf(m, "pty:slave"); | 57 | seq_puts(m, "pty:slave"); |
58 | else | 58 | else |
59 | seq_printf(m, "pty"); | 59 | seq_puts(m, "pty"); |
60 | break; | 60 | break; |
61 | default: | 61 | default: |
62 | seq_printf(m, "type:%d.%d", p->type, p->subtype); | 62 | seq_printf(m, "type:%d.%d", p->type, p->subtype); |
@@ -74,19 +74,19 @@ static int show_tty_driver(struct seq_file *m, void *v) | |||
74 | /* pseudo-drivers first */ | 74 | /* pseudo-drivers first */ |
75 | seq_printf(m, "%-20s /dev/%-8s ", "/dev/tty", "tty"); | 75 | seq_printf(m, "%-20s /dev/%-8s ", "/dev/tty", "tty"); |
76 | seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 0); | 76 | seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 0); |
77 | seq_printf(m, "system:/dev/tty\n"); | 77 | seq_puts(m, "system:/dev/tty\n"); |
78 | seq_printf(m, "%-20s /dev/%-8s ", "/dev/console", "console"); | 78 | seq_printf(m, "%-20s /dev/%-8s ", "/dev/console", "console"); |
79 | seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 1); | 79 | seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 1); |
80 | seq_printf(m, "system:console\n"); | 80 | seq_puts(m, "system:console\n"); |
81 | #ifdef CONFIG_UNIX98_PTYS | 81 | #ifdef CONFIG_UNIX98_PTYS |
82 | seq_printf(m, "%-20s /dev/%-8s ", "/dev/ptmx", "ptmx"); | 82 | seq_printf(m, "%-20s /dev/%-8s ", "/dev/ptmx", "ptmx"); |
83 | seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 2); | 83 | seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 2); |
84 | seq_printf(m, "system\n"); | 84 | seq_puts(m, "system\n"); |
85 | #endif | 85 | #endif |
86 | #ifdef CONFIG_VT | 86 | #ifdef CONFIG_VT |
87 | seq_printf(m, "%-20s /dev/%-8s ", "/dev/vc/0", "vc/0"); | 87 | seq_printf(m, "%-20s /dev/%-8s ", "/dev/vc/0", "vc/0"); |
88 | seq_printf(m, "%3d %7d ", TTY_MAJOR, 0); | 88 | seq_printf(m, "%3d %7d ", TTY_MAJOR, 0); |
89 | seq_printf(m, "system:vtmaster\n"); | 89 | seq_puts(m, "system:vtmaster\n"); |
90 | #endif | 90 | #endif |
91 | } | 91 | } |
92 | 92 | ||
diff --git a/fs/proc/softirqs.c b/fs/proc/softirqs.c index 37994737c983..62604be9f58d 100644 --- a/fs/proc/softirqs.c +++ b/fs/proc/softirqs.c | |||
@@ -10,16 +10,16 @@ static int show_softirqs(struct seq_file *p, void *v) | |||
10 | { | 10 | { |
11 | int i, j; | 11 | int i, j; |
12 | 12 | ||
13 | seq_printf(p, " "); | 13 | seq_puts(p, " "); |
14 | for_each_possible_cpu(i) | 14 | for_each_possible_cpu(i) |
15 | seq_printf(p, "CPU%-8d", i); | 15 | seq_printf(p, "CPU%-8d", i); |
16 | seq_printf(p, "\n"); | 16 | seq_putc(p, '\n'); |
17 | 17 | ||
18 | for (i = 0; i < NR_SOFTIRQS; i++) { | 18 | for (i = 0; i < NR_SOFTIRQS; i++) { |
19 | seq_printf(p, "%12s:", softirq_to_name[i]); | 19 | seq_printf(p, "%12s:", softirq_to_name[i]); |
20 | for_each_possible_cpu(j) | 20 | for_each_possible_cpu(j) |
21 | seq_printf(p, " %10u", kstat_softirqs_cpu(i, j)); | 21 | seq_printf(p, " %10u", kstat_softirqs_cpu(i, j)); |
22 | seq_printf(p, "\n"); | 22 | seq_putc(p, '\n'); |
23 | } | 23 | } |
24 | return 0; | 24 | return 0; |
25 | } | 25 | } |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index e15a19c93bae..1cffa2b8a2fc 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
@@ -126,7 +126,7 @@ static int show_stat(struct seq_file *p, void *v) | |||
126 | 126 | ||
127 | for (i = 0; i < NR_SOFTIRQS; i++) | 127 | for (i = 0; i < NR_SOFTIRQS; i++) |
128 | seq_printf(p, " %u", per_softirq_sums[i]); | 128 | seq_printf(p, " %u", per_softirq_sums[i]); |
129 | seq_printf(p, "\n"); | 129 | seq_putc(p, '\n'); |
130 | 130 | ||
131 | return 0; | 131 | return 0; |
132 | } | 132 | } |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index c126c83b9a45..60b914860f81 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -66,8 +66,9 @@ unsigned long task_vsize(struct mm_struct *mm) | |||
66 | return PAGE_SIZE * mm->total_vm; | 66 | return PAGE_SIZE * mm->total_vm; |
67 | } | 67 | } |
68 | 68 | ||
69 | int task_statm(struct mm_struct *mm, int *shared, int *text, | 69 | unsigned long task_statm(struct mm_struct *mm, |
70 | int *data, int *resident) | 70 | unsigned long *shared, unsigned long *text, |
71 | unsigned long *data, unsigned long *resident) | ||
71 | { | 72 | { |
72 | *shared = get_mm_counter(mm, MM_FILEPAGES); | 73 | *shared = get_mm_counter(mm, MM_FILEPAGES); |
73 | *text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK)) | 74 | *text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK)) |
@@ -417,7 +418,8 @@ static int show_smap(struct seq_file *m, void *v) | |||
417 | "Anonymous: %8lu kB\n" | 418 | "Anonymous: %8lu kB\n" |
418 | "Swap: %8lu kB\n" | 419 | "Swap: %8lu kB\n" |
419 | "KernelPageSize: %8lu kB\n" | 420 | "KernelPageSize: %8lu kB\n" |
420 | "MMUPageSize: %8lu kB\n", | 421 | "MMUPageSize: %8lu kB\n" |
422 | "Locked: %8lu kB\n", | ||
421 | (vma->vm_end - vma->vm_start) >> 10, | 423 | (vma->vm_end - vma->vm_start) >> 10, |
422 | mss.resident >> 10, | 424 | mss.resident >> 10, |
423 | (unsigned long)(mss.pss >> (10 + PSS_SHIFT)), | 425 | (unsigned long)(mss.pss >> (10 + PSS_SHIFT)), |
@@ -429,7 +431,9 @@ static int show_smap(struct seq_file *m, void *v) | |||
429 | mss.anonymous >> 10, | 431 | mss.anonymous >> 10, |
430 | mss.swap >> 10, | 432 | mss.swap >> 10, |
431 | vma_kernel_pagesize(vma) >> 10, | 433 | vma_kernel_pagesize(vma) >> 10, |
432 | vma_mmu_pagesize(vma) >> 10); | 434 | vma_mmu_pagesize(vma) >> 10, |
435 | (vma->vm_flags & VM_LOCKED) ? | ||
436 | (unsigned long)(mss.pss >> (10 + PSS_SHIFT)) : 0); | ||
433 | 437 | ||
434 | if (m->count < m->size) /* vma is copied successfully */ | 438 | if (m->count < m->size) /* vma is copied successfully */ |
435 | m->version = (vma != get_gate_vma(task)) ? vma->vm_start : 0; | 439 | m->version = (vma != get_gate_vma(task)) ? vma->vm_start : 0; |
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index cb6306e63843..b535d3e5d5f1 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c | |||
@@ -92,13 +92,14 @@ unsigned long task_vsize(struct mm_struct *mm) | |||
92 | return vsize; | 92 | return vsize; |
93 | } | 93 | } |
94 | 94 | ||
95 | int task_statm(struct mm_struct *mm, int *shared, int *text, | 95 | unsigned long task_statm(struct mm_struct *mm, |
96 | int *data, int *resident) | 96 | unsigned long *shared, unsigned long *text, |
97 | unsigned long *data, unsigned long *resident) | ||
97 | { | 98 | { |
98 | struct vm_area_struct *vma; | 99 | struct vm_area_struct *vma; |
99 | struct vm_region *region; | 100 | struct vm_region *region; |
100 | struct rb_node *p; | 101 | struct rb_node *p; |
101 | int size = kobjsize(mm); | 102 | unsigned long size = kobjsize(mm); |
102 | 103 | ||
103 | down_read(&mm->mmap_sem); | 104 | down_read(&mm->mmap_sem); |
104 | for (p = rb_first(&mm->mm_rb); p; p = rb_next(p)) { | 105 | for (p = rb_first(&mm->mm_rb); p; p = rb_next(p)) { |