aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorJoonsoo Kim <js1304@gmail.com>2013-04-29 18:07:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 18:54:33 -0400
commitdb3808c1bac64740b9d830fda92801ae65f1c851 (patch)
tree5f209495fa8865cf7283ae928f566142bb9a9c00 /fs/proc
parentef93247325028a35e089f3012c270379a89d052c (diff)
mm, vmalloc: move get_vmalloc_info() to vmalloc.c
Now get_vmalloc_info() is in fs/proc/mmu.c. There is no reason that this code must be here and it's implementation needs vmlist_lock and it iterate a vmlist which may be internal data structure for vmalloc. It is preferable that vmlist_lock and vmlist is only used in vmalloc.c for maintainability. So move the code to vmalloc.c Signed-off-by: Joonsoo Kim <js1304@gmail.com> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: Dave Anderson <anderson@redhat.com> Cc: Eric Biederman <ebiederm@xmission.com> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn> Cc: Ingo Molnar <mingo@kernel.org> Cc: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/Makefile2
-rw-r--r--fs/proc/internal.h18
-rw-r--r--fs/proc/meminfo.c1
-rw-r--r--fs/proc/mmu.c60
4 files changed, 2 insertions, 79 deletions
diff --git a/fs/proc/Makefile b/fs/proc/Makefile
index 712f24db9600..ab30716584f5 100644
--- a/fs/proc/Makefile
+++ b/fs/proc/Makefile
@@ -5,7 +5,7 @@
5obj-y += proc.o 5obj-y += proc.o
6 6
7proc-y := nommu.o task_nommu.o 7proc-y := nommu.o task_nommu.o
8proc-$(CONFIG_MMU) := mmu.o task_mmu.o 8proc-$(CONFIG_MMU) := task_mmu.o
9 9
10proc-y += inode.o root.o base.o generic.o array.o \ 10proc-y += inode.o root.o base.o generic.o array.o \
11 fd.o 11 fd.o
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 85ff3a4598b3..75710357a517 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -30,24 +30,6 @@ extern int proc_net_init(void);
30static inline int proc_net_init(void) { return 0; } 30static inline int proc_net_init(void) { return 0; }
31#endif 31#endif
32 32
33struct vmalloc_info {
34 unsigned long used;
35 unsigned long largest_chunk;
36};
37
38#ifdef CONFIG_MMU
39#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
40extern void get_vmalloc_info(struct vmalloc_info *vmi);
41#else
42
43#define VMALLOC_TOTAL 0UL
44#define get_vmalloc_info(vmi) \
45do { \
46 (vmi)->used = 0; \
47 (vmi)->largest_chunk = 0; \
48} while(0)
49#endif
50
51extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns, 33extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns,
52 struct pid *pid, struct task_struct *task); 34 struct pid *pid, struct task_struct *task);
53extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns, 35extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns,
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 1efaaa19c4f3..5aa847a603c0 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -11,6 +11,7 @@
11#include <linux/swap.h> 11#include <linux/swap.h>
12#include <linux/vmstat.h> 12#include <linux/vmstat.h>
13#include <linux/atomic.h> 13#include <linux/atomic.h>
14#include <linux/vmalloc.h>
14#include <asm/page.h> 15#include <asm/page.h>
15#include <asm/pgtable.h> 16#include <asm/pgtable.h>
16#include "internal.h" 17#include "internal.h"
diff --git a/fs/proc/mmu.c b/fs/proc/mmu.c
deleted file mode 100644
index 8ae221dfd010..000000000000
--- a/fs/proc/mmu.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/* mmu.c: mmu memory info files
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#include <linux/spinlock.h>
12#include <linux/vmalloc.h>
13#include <linux/highmem.h>
14#include <asm/pgtable.h>
15#include "internal.h"
16
17void get_vmalloc_info(struct vmalloc_info *vmi)
18{
19 struct vm_struct *vma;
20 unsigned long free_area_size;
21 unsigned long prev_end;
22
23 vmi->used = 0;
24
25 if (!vmlist) {
26 vmi->largest_chunk = VMALLOC_TOTAL;
27 }
28 else {
29 vmi->largest_chunk = 0;
30
31 prev_end = VMALLOC_START;
32
33 read_lock(&vmlist_lock);
34
35 for (vma = vmlist; vma; vma = vma->next) {
36 unsigned long addr = (unsigned long) vma->addr;
37
38 /*
39 * Some archs keep another range for modules in vmlist
40 */
41 if (addr < VMALLOC_START)
42 continue;
43 if (addr >= VMALLOC_END)
44 break;
45
46 vmi->used += vma->size;
47
48 free_area_size = addr - prev_end;
49 if (vmi->largest_chunk < free_area_size)
50 vmi->largest_chunk = free_area_size;
51
52 prev_end = vma->size + addr;
53 }
54
55 if (VMALLOC_END - prev_end > vmi->largest_chunk)
56 vmi->largest_chunk = VMALLOC_END - prev_end;
57
58 read_unlock(&vmlist_lock);
59 }
60}