diff options
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/generic.c | 2 | ||||
-rw-r--r-- | fs/proc/inode.c | 2 | ||||
-rw-r--r-- | fs/proc/internal.h | 4 | ||||
-rw-r--r-- | fs/proc/proc_misc.c | 4 | ||||
-rw-r--r-- | fs/proc/root.c | 3 | ||||
-rw-r--r-- | fs/proc/task_mmu.c | 127 |
6 files changed, 18 insertions, 124 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 72b431d0a0a4..20e5c4509a43 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/bitops.h> | 21 | #include <linux/bitops.h> |
22 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
23 | 23 | ||
24 | #include "internal.h" | ||
25 | |||
24 | static ssize_t proc_file_read(struct file *file, char __user *buf, | 26 | static ssize_t proc_file_read(struct file *file, char __user *buf, |
25 | size_t nbytes, loff_t *ppos); | 27 | size_t nbytes, loff_t *ppos); |
26 | static ssize_t proc_file_write(struct file *file, const char __user *buffer, | 28 | static ssize_t proc_file_write(struct file *file, const char __user *buffer, |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index e6a818a93f3d..6573f31f1fd9 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <asm/system.h> | 19 | #include <asm/system.h> |
20 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
21 | 21 | ||
22 | extern void free_proc_entry(struct proc_dir_entry *); | 22 | #include "internal.h" |
23 | 23 | ||
24 | static inline struct proc_dir_entry * de_get(struct proc_dir_entry *de) | 24 | static inline struct proc_dir_entry * de_get(struct proc_dir_entry *de) |
25 | { | 25 | { |
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 3e55198f9806..95a1cf32b838 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -37,6 +37,10 @@ extern int proc_tgid_stat(struct task_struct *, char *); | |||
37 | extern int proc_pid_status(struct task_struct *, char *); | 37 | extern int proc_pid_status(struct task_struct *, char *); |
38 | extern int proc_pid_statm(struct task_struct *, char *); | 38 | extern int proc_pid_statm(struct task_struct *, char *); |
39 | 39 | ||
40 | void free_proc_entry(struct proc_dir_entry *de); | ||
41 | |||
42 | int proc_init_inodecache(void); | ||
43 | |||
40 | static inline struct task_struct *proc_task(struct inode *inode) | 44 | static inline struct task_struct *proc_task(struct inode *inode) |
41 | { | 45 | { |
42 | return PROC_I(inode)->task; | 46 | return PROC_I(inode)->task; |
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 5b6b0b6038a7..63bf6c00fa0c 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -323,6 +323,7 @@ static struct file_operations proc_modules_operations = { | |||
323 | }; | 323 | }; |
324 | #endif | 324 | #endif |
325 | 325 | ||
326 | #ifdef CONFIG_SLAB | ||
326 | extern struct seq_operations slabinfo_op; | 327 | extern struct seq_operations slabinfo_op; |
327 | extern ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); | 328 | extern ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); |
328 | static int slabinfo_open(struct inode *inode, struct file *file) | 329 | static int slabinfo_open(struct inode *inode, struct file *file) |
@@ -336,6 +337,7 @@ static struct file_operations proc_slabinfo_operations = { | |||
336 | .llseek = seq_lseek, | 337 | .llseek = seq_lseek, |
337 | .release = seq_release, | 338 | .release = seq_release, |
338 | }; | 339 | }; |
340 | #endif | ||
339 | 341 | ||
340 | static int show_stat(struct seq_file *p, void *v) | 342 | static int show_stat(struct seq_file *p, void *v) |
341 | { | 343 | { |
@@ -600,7 +602,9 @@ void __init proc_misc_init(void) | |||
600 | create_seq_entry("partitions", 0, &proc_partitions_operations); | 602 | create_seq_entry("partitions", 0, &proc_partitions_operations); |
601 | create_seq_entry("stat", 0, &proc_stat_operations); | 603 | create_seq_entry("stat", 0, &proc_stat_operations); |
602 | create_seq_entry("interrupts", 0, &proc_interrupts_operations); | 604 | create_seq_entry("interrupts", 0, &proc_interrupts_operations); |
605 | #ifdef CONFIG_SLAB | ||
603 | create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); | 606 | create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); |
607 | #endif | ||
604 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); | 608 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); |
605 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); | 609 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); |
606 | create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations); | 610 | create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations); |
diff --git a/fs/proc/root.c b/fs/proc/root.c index aef148f099a2..68896283c8ae 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/bitops.h> | 18 | #include <linux/bitops.h> |
19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
20 | 20 | ||
21 | #include "internal.h" | ||
22 | |||
21 | struct proc_dir_entry *proc_net, *proc_net_stat, *proc_bus, *proc_root_fs, *proc_root_driver; | 23 | struct proc_dir_entry *proc_net, *proc_net_stat, *proc_bus, *proc_root_fs, *proc_root_driver; |
22 | 24 | ||
23 | #ifdef CONFIG_SYSCTL | 25 | #ifdef CONFIG_SYSCTL |
@@ -36,7 +38,6 @@ static struct file_system_type proc_fs_type = { | |||
36 | .kill_sb = kill_anon_super, | 38 | .kill_sb = kill_anon_super, |
37 | }; | 39 | }; |
38 | 40 | ||
39 | extern int __init proc_init_inodecache(void); | ||
40 | void __init proc_root_init(void) | 41 | void __init proc_root_init(void) |
41 | { | 42 | { |
42 | int err = proc_init_inodecache(); | 43 | int err = proc_init_inodecache(); |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 50bd5a8f0446..0eaad41f4658 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -390,129 +390,12 @@ struct seq_operations proc_pid_smaps_op = { | |||
390 | }; | 390 | }; |
391 | 391 | ||
392 | #ifdef CONFIG_NUMA | 392 | #ifdef CONFIG_NUMA |
393 | 393 | extern int show_numa_map(struct seq_file *m, void *v); | |
394 | struct numa_maps { | ||
395 | unsigned long pages; | ||
396 | unsigned long anon; | ||
397 | unsigned long mapped; | ||
398 | unsigned long mapcount_max; | ||
399 | unsigned long node[MAX_NUMNODES]; | ||
400 | }; | ||
401 | |||
402 | /* | ||
403 | * Calculate numa node maps for a vma | ||
404 | */ | ||
405 | static struct numa_maps *get_numa_maps(struct vm_area_struct *vma) | ||
406 | { | ||
407 | int i; | ||
408 | struct page *page; | ||
409 | unsigned long vaddr; | ||
410 | struct numa_maps *md = kmalloc(sizeof(struct numa_maps), GFP_KERNEL); | ||
411 | |||
412 | if (!md) | ||
413 | return NULL; | ||
414 | md->pages = 0; | ||
415 | md->anon = 0; | ||
416 | md->mapped = 0; | ||
417 | md->mapcount_max = 0; | ||
418 | for_each_node(i) | ||
419 | md->node[i] =0; | ||
420 | |||
421 | for (vaddr = vma->vm_start; vaddr < vma->vm_end; vaddr += PAGE_SIZE) { | ||
422 | page = follow_page(vma, vaddr, 0); | ||
423 | if (page) { | ||
424 | int count = page_mapcount(page); | ||
425 | |||
426 | if (count) | ||
427 | md->mapped++; | ||
428 | if (count > md->mapcount_max) | ||
429 | md->mapcount_max = count; | ||
430 | md->pages++; | ||
431 | if (PageAnon(page)) | ||
432 | md->anon++; | ||
433 | md->node[page_to_nid(page)]++; | ||
434 | } | ||
435 | cond_resched(); | ||
436 | } | ||
437 | return md; | ||
438 | } | ||
439 | |||
440 | static int show_numa_map(struct seq_file *m, void *v) | ||
441 | { | ||
442 | struct task_struct *task = m->private; | ||
443 | struct vm_area_struct *vma = v; | ||
444 | struct mempolicy *pol; | ||
445 | struct numa_maps *md; | ||
446 | struct zone **z; | ||
447 | int n; | ||
448 | int first; | ||
449 | |||
450 | if (!vma->vm_mm) | ||
451 | return 0; | ||
452 | |||
453 | md = get_numa_maps(vma); | ||
454 | if (!md) | ||
455 | return 0; | ||
456 | |||
457 | seq_printf(m, "%08lx", vma->vm_start); | ||
458 | pol = get_vma_policy(task, vma, vma->vm_start); | ||
459 | /* Print policy */ | ||
460 | switch (pol->policy) { | ||
461 | case MPOL_PREFERRED: | ||
462 | seq_printf(m, " prefer=%d", pol->v.preferred_node); | ||
463 | break; | ||
464 | case MPOL_BIND: | ||
465 | seq_printf(m, " bind={"); | ||
466 | first = 1; | ||
467 | for (z = pol->v.zonelist->zones; *z; z++) { | ||
468 | |||
469 | if (!first) | ||
470 | seq_putc(m, ','); | ||
471 | else | ||
472 | first = 0; | ||
473 | seq_printf(m, "%d/%s", (*z)->zone_pgdat->node_id, | ||
474 | (*z)->name); | ||
475 | } | ||
476 | seq_putc(m, '}'); | ||
477 | break; | ||
478 | case MPOL_INTERLEAVE: | ||
479 | seq_printf(m, " interleave={"); | ||
480 | first = 1; | ||
481 | for_each_node(n) { | ||
482 | if (node_isset(n, pol->v.nodes)) { | ||
483 | if (!first) | ||
484 | seq_putc(m,','); | ||
485 | else | ||
486 | first = 0; | ||
487 | seq_printf(m, "%d",n); | ||
488 | } | ||
489 | } | ||
490 | seq_putc(m, '}'); | ||
491 | break; | ||
492 | default: | ||
493 | seq_printf(m," default"); | ||
494 | break; | ||
495 | } | ||
496 | seq_printf(m, " MaxRef=%lu Pages=%lu Mapped=%lu", | ||
497 | md->mapcount_max, md->pages, md->mapped); | ||
498 | if (md->anon) | ||
499 | seq_printf(m," Anon=%lu",md->anon); | ||
500 | |||
501 | for_each_online_node(n) { | ||
502 | if (md->node[n]) | ||
503 | seq_printf(m, " N%d=%lu", n, md->node[n]); | ||
504 | } | ||
505 | seq_putc(m, '\n'); | ||
506 | kfree(md); | ||
507 | if (m->count < m->size) /* vma is copied successfully */ | ||
508 | m->version = (vma != get_gate_vma(task)) ? vma->vm_start : 0; | ||
509 | return 0; | ||
510 | } | ||
511 | 394 | ||
512 | struct seq_operations proc_pid_numa_maps_op = { | 395 | struct seq_operations proc_pid_numa_maps_op = { |
513 | .start = m_start, | 396 | .start = m_start, |
514 | .next = m_next, | 397 | .next = m_next, |
515 | .stop = m_stop, | 398 | .stop = m_stop, |
516 | .show = show_numa_map | 399 | .show = show_numa_map |
517 | }; | 400 | }; |
518 | #endif | 401 | #endif |