Commit bb1f17b0372de93758653ca3454bc0df18dc2e5c

Authored by Alexey Dobriyan
Committed by Linus Torvalds
1 parent 3b0fde0fac

mm: consolidate init_mm definition

* create mm/init-mm.c, move init_mm there
* remove INIT_MM, initialize init_mm with C99 initializer
* unexport init_mm on all arches:

  init_mm is already unexported on x86.

  One strange place is some OMAP driver (drivers/video/omap/) which
  won't build modular, but it's already wants get_vm_area() export.
  Somebody should look there.

[akpm@linux-foundation.org: add missing #includes]
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Cc: Americo Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 24 changed files with 21 additions and 88 deletions Side-by-side Diff

arch/alpha/kernel/init_task.c
... ... @@ -10,10 +10,7 @@
10 10  
11 11 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
12 12 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
13   -struct mm_struct init_mm = INIT_MM(init_mm);
14 13 struct task_struct init_task = INIT_TASK(init_task);
15   -
16   -EXPORT_SYMBOL(init_mm);
17 14 EXPORT_SYMBOL(init_task);
18 15  
19 16 union thread_union init_thread_union
arch/arm/kernel/init_task.c
... ... @@ -14,10 +14,6 @@
14 14  
15 15 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16 16 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17   -struct mm_struct init_mm = INIT_MM(init_mm);
18   -
19   -EXPORT_SYMBOL(init_mm);
20   -
21 17 /*
22 18 * Initial thread structure.
23 19 *
arch/avr32/kernel/init_task.c
... ... @@ -15,10 +15,6 @@
15 15  
16 16 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
17 17 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
18   -struct mm_struct init_mm = INIT_MM(init_mm);
19   -
20   -EXPORT_SYMBOL(init_mm);
21   -
22 18 /*
23 19 * Initial thread structure. Must be aligned on an 8192-byte boundary.
24 20 */
arch/blackfin/kernel/init_task.c
... ... @@ -35,10 +35,6 @@
35 35  
36 36 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
37 37 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
38   -
39   -struct mm_struct init_mm = INIT_MM(init_mm);
40   -EXPORT_SYMBOL(init_mm);
41   -
42 38 /*
43 39 * Initial task structure.
44 40 *
arch/cris/kernel/process.c
... ... @@ -38,10 +38,6 @@
38 38  
39 39 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
40 40 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
41   -struct mm_struct init_mm = INIT_MM(init_mm);
42   -
43   -EXPORT_SYMBOL(init_mm);
44   -
45 41 /*
46 42 * Initial thread structure.
47 43 *
arch/frv/kernel/init_task.c
... ... @@ -12,10 +12,6 @@
12 12  
13 13 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
14 14 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
15   -struct mm_struct init_mm = INIT_MM(init_mm);
16   -
17   -EXPORT_SYMBOL(init_mm);
18   -
19 15 /*
20 16 * Initial thread structure.
21 17 *
arch/h8300/kernel/init_task.c
... ... @@ -14,10 +14,6 @@
14 14  
15 15 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16 16 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17   -struct mm_struct init_mm = INIT_MM(init_mm);
18   -
19   -EXPORT_SYMBOL(init_mm);
20   -
21 17 /*
22 18 * Initial task structure.
23 19 *
arch/ia64/kernel/init_task.c
... ... @@ -19,10 +19,6 @@
19 19  
20 20 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
21 21 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
22   -struct mm_struct init_mm = INIT_MM(init_mm);
23   -
24   -EXPORT_SYMBOL(init_mm);
25   -
26 22 /*
27 23 * Initial task structure.
28 24 *
arch/m32r/kernel/init_task.c
... ... @@ -13,10 +13,6 @@
13 13  
14 14 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
15 15 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
16   -struct mm_struct init_mm = INIT_MM(init_mm);
17   -
18   -EXPORT_SYMBOL(init_mm);
19   -
20 16 /*
21 17 * Initial thread structure.
22 18 *
arch/m68k/kernel/process.c
... ... @@ -42,10 +42,6 @@
42 42 */
43 43 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
44 44 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
45   -struct mm_struct init_mm = INIT_MM(init_mm);
46   -
47   -EXPORT_SYMBOL(init_mm);
48   -
49 45 union thread_union init_thread_union
50 46 __attribute__((section(".data.init_task"), aligned(THREAD_SIZE)))
51 47 = { INIT_THREAD_INFO(init_task) };
arch/m68knommu/kernel/init_task.c
... ... @@ -14,10 +14,6 @@
14 14  
15 15 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16 16 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17   -struct mm_struct init_mm = INIT_MM(init_mm);
18   -
19   -EXPORT_SYMBOL(init_mm);
20   -
21 17 /*
22 18 * Initial task structure.
23 19 *
arch/mips/kernel/init_task.c
... ... @@ -11,10 +11,6 @@
11 11  
12 12 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
13 13 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
14   -struct mm_struct init_mm = INIT_MM(init_mm);
15   -
16   -EXPORT_SYMBOL(init_mm);
17   -
18 14 /*
19 15 * Initial thread structure.
20 16 *
arch/mn10300/kernel/init_task.c
... ... @@ -20,9 +20,6 @@
20 20  
21 21 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
22 22 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
23   -struct mm_struct init_mm = INIT_MM(init_mm);
24   -EXPORT_SYMBOL(init_mm);
25   -
26 23 /*
27 24 * Initial thread structure.
28 25 *
arch/parisc/kernel/init_task.c
... ... @@ -36,10 +36,6 @@
36 36  
37 37 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
38 38 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
39   -struct mm_struct init_mm = INIT_MM(init_mm);
40   -
41   -EXPORT_SYMBOL(init_mm);
42   -
43 39 /*
44 40 * Initial task structure.
45 41 *
arch/powerpc/kernel/init_task.c
... ... @@ -9,10 +9,6 @@
9 9  
10 10 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
11 11 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
12   -struct mm_struct init_mm = INIT_MM(init_mm);
13   -
14   -EXPORT_SYMBOL(init_mm);
15   -
16 12 /*
17 13 * Initial thread structure.
18 14 *
arch/s390/kernel/init_task.c
... ... @@ -18,10 +18,6 @@
18 18  
19 19 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
20 20 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
21   -struct mm_struct init_mm = INIT_MM(init_mm);
22   -
23   -EXPORT_SYMBOL(init_mm);
24   -
25 21 /*
26 22 * Initial thread structure.
27 23 *
arch/sh/kernel/init_task.c
... ... @@ -10,9 +10,6 @@
10 10 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
11 11 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
12 12 struct pt_regs fake_swapper_regs;
13   -struct mm_struct init_mm = INIT_MM(init_mm);
14   -EXPORT_SYMBOL(init_mm);
15   -
16 13 /*
17 14 * Initial thread structure.
18 15 *
arch/sparc/kernel/init_task.c
... ... @@ -10,10 +10,7 @@
10 10  
11 11 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
12 12 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
13   -struct mm_struct init_mm = INIT_MM(init_mm);
14 13 struct task_struct init_task = INIT_TASK(init_task);
15   -
16   -EXPORT_SYMBOL(init_mm);
17 14 EXPORT_SYMBOL(init_task);
18 15  
19 16 /* .text section in head.S is aligned at 8k boundary and this gets linked
arch/um/kernel/init_task.c
... ... @@ -10,11 +10,8 @@
10 10 #include "linux/mqueue.h"
11 11 #include "asm/uaccess.h"
12 12  
13   -struct mm_struct init_mm = INIT_MM(init_mm);
14 13 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
15 14 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
16   -EXPORT_SYMBOL(init_mm);
17   -
18 15 /*
19 16 * Initial task structure.
20 17 *
arch/x86/kernel/init_task.c
... ... @@ -12,7 +12,6 @@
12 12  
13 13 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
14 14 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
15   -struct mm_struct init_mm = INIT_MM(init_mm);
16 15  
17 16 /*
18 17 * Initial thread structure.
arch/xtensa/kernel/init_task.c
... ... @@ -23,10 +23,6 @@
23 23  
24 24 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
25 25 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
26   -struct mm_struct init_mm = INIT_MM(init_mm);
27   -
28   -EXPORT_SYMBOL(init_mm);
29   -
30 26 union thread_union init_thread_union
31 27 __attribute__((__section__(".data.init_task"))) =
32 28 { INIT_THREAD_INFO(init_task) };
include/linux/init_task.h
... ... @@ -15,18 +15,6 @@
15 15 extern struct files_struct init_files;
16 16 extern struct fs_struct init_fs;
17 17  
18   -#define INIT_MM(name) \
19   -{ \
20   - .mm_rb = RB_ROOT, \
21   - .pgd = swapper_pg_dir, \
22   - .mm_users = ATOMIC_INIT(2), \
23   - .mm_count = ATOMIC_INIT(1), \
24   - .mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), \
25   - .page_table_lock = __SPIN_LOCK_UNLOCKED(name.page_table_lock), \
26   - .mmlist = LIST_HEAD_INIT(name.mmlist), \
27   - .cpu_vm_mask = CPU_MASK_ALL, \
28   -}
29   -
30 18 #define INIT_SIGNALS(sig) { \
31 19 .count = ATOMIC_INIT(1), \
32 20 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
... ... @@ -12,6 +12,7 @@
12 12 readahead.o swap.o truncate.o vmscan.o shmem.o \
13 13 prio_tree.o util.o mmzone.o vmstat.o backing-dev.o \
14 14 page_isolation.o mm_init.o $(mmu-y)
  15 +obj-y += init-mm.o
15 16  
16 17 obj-$(CONFIG_PROC_PAGE_MONITOR) += pagewalk.o
17 18 obj-$(CONFIG_BOUNCE) += bounce.o
  1 +#include <linux/mm_types.h>
  2 +#include <linux/rbtree.h>
  3 +#include <linux/rwsem.h>
  4 +#include <linux/spinlock.h>
  5 +#include <linux/list.h>
  6 +#include <linux/cpumask.h>
  7 +
  8 +#include <asm/atomic.h>
  9 +#include <asm/pgtable.h>
  10 +
  11 +struct mm_struct init_mm = {
  12 + .mm_rb = RB_ROOT,
  13 + .pgd = swapper_pg_dir,
  14 + .mm_users = ATOMIC_INIT(2),
  15 + .mm_count = ATOMIC_INIT(1),
  16 + .mmap_sem = __RWSEM_INITIALIZER(init_mm.mmap_sem),
  17 + .page_table_lock = __SPIN_LOCK_UNLOCKED(init_mm.page_table_lock),
  18 + .mmlist = LIST_HEAD_INIT(init_mm.mmlist),
  19 + .cpu_vm_mask = CPU_MASK_ALL,
  20 +};