mm: consolidate init_mm definition
authorAlexey Dobriyan <adobriyan@gmail.com>
Tue, 16 Jun 2009 22:31:18 +0000 (15:31 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 17 Jun 2009 02:47:28 +0000 (19:47 -0700)
* 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>
24 files changed:
arch/alpha/kernel/init_task.c
arch/arm/kernel/init_task.c
arch/avr32/kernel/init_task.c
arch/blackfin/kernel/init_task.c
arch/cris/kernel/process.c
arch/frv/kernel/init_task.c
arch/h8300/kernel/init_task.c
arch/ia64/kernel/init_task.c
arch/m32r/kernel/init_task.c
arch/m68k/kernel/process.c
arch/m68knommu/kernel/init_task.c
arch/mips/kernel/init_task.c
arch/mn10300/kernel/init_task.c
arch/parisc/kernel/init_task.c
arch/powerpc/kernel/init_task.c
arch/s390/kernel/init_task.c
arch/sh/kernel/init_task.c
arch/sparc/kernel/init_task.c
arch/um/kernel/init_task.c
arch/x86/kernel/init_task.c
arch/xtensa/kernel/init_task.c
include/linux/init_task.h
mm/Makefile
mm/init-mm.c [new file with mode: 0644]

index c2938e574a40c2de349556430bc83fc0038569c0..19b86328ffd7907d437eca4ab61055dfadda1a09 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
 struct task_struct init_task = INIT_TASK(init_task);
-
-EXPORT_SYMBOL(init_mm);
 EXPORT_SYMBOL(init_task);
 
 union thread_union init_thread_union
index e859af349467420e3107074cfa94f7d993125c70..3f470866bb89ebe4f903db8dfb389313505df502 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial thread structure.
  *
index 993d56ee3cf303375a57328680fdc23aa25728f6..57ec9f2dcd953b2ebe9270f1c9dbfa6cf99d2401 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial thread structure. Must be aligned on an 8192-byte boundary.
  */
index 2c228c020978eee16b8edecc047d12689fb1c016..c26c34de9f3cb096580d3d48ef9de3a728d9f975 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-
-struct mm_struct init_mm = INIT_MM(init_mm);
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial task structure.
  *
index 4df0b320d524e351847e9f2b270237731b2b1607..51dcd04d2777f01b87a86108d500efb800be1d2d 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial thread structure.
  *
index 29429a8b7f6a44b0a6e52629c9b134d0f72317e3..1d3df1d9495c3379180ad6b9cf683cc9b5f24b25 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial thread structure.
  *
index cb5dc552da97899e4f443b40efd5fae50de4f3f1..089c65ed6eb327c5e8ffa39e5a69a5c6e5d86921 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial task structure.
  *
index 5b0e830c6f33212d48b28ec74f24113f6c1bc5ef..c475fc281be755accd969935eb8bd278069a1ffe 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial task structure.
  *
index 016885c6f26094b3191fc8f790410d7a99b5c143..fce57e5d3f913950b96c5185209bc3e9b066f986 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial thread structure.
  *
index ec37fb56c127a095ed8f5060c8af8ff6672f90d0..72bad65dba3a1d3b4091f074c22207aa8f9a277b 100644 (file)
  */
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 union thread_union init_thread_union
 __attribute__((section(".data.init_task"), aligned(THREAD_SIZE)))
        = { INIT_THREAD_INFO(init_task) };
index fe282de1d596dcb4b93d4077ba8c5fe4c6f3aaee..45e97a207fedaf57a2cab44f97d7d0370cf95e2b 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial task structure.
  *
index 149cd914526e8e2e2d1c407852879cf2111fa822..5b457a40c784f84997c9bc24c17de910ecbe61b3 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial thread structure.
  *
index 5ac3566f8c98b62c5a96673665b09f12d5a48696..80d423b80af30cfebbf7364829153c6f3314a3b1 100644 (file)
@@ -20,9 +20,6 @@
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial thread structure.
  *
index 1e25a45d64c17fd48d461489c3f2e950ed29ee53..82974b20fc106b85c0462cc83e78eb2c3201a1c4 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial task structure.
  *
index 688b329800bd25f559c75f2ea6f0dcdd22ade3b1..ffc4253fef55e99a59070b09f1b912e51bfb4de8 100644 (file)
@@ -9,10 +9,6 @@
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial thread structure.
  *
index 7db95c0b86938603176baf5496f23338cd455bc2..fe787f9e5f3f375753291b01f1e135546b5875b6 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial thread structure.
  *
index 80c35ff71d564d524cf01c752efd0618fa868308..1719957c0a691202b192da5c9a6329e810dcc44f 100644 (file)
@@ -10,9 +10,6 @@
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
 struct pt_regs fake_swapper_regs;
-struct mm_struct init_mm = INIT_MM(init_mm);
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial thread structure.
  *
index f28cb8278e98abb6f2fb79c634b2e74e52cfac84..28125c5b3d3c306e216012ac7b529fa6b0f33e0a 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
 struct task_struct init_task = INIT_TASK(init_task);
-
-EXPORT_SYMBOL(init_mm);
 EXPORT_SYMBOL(init_task);
 
 /* .text section in head.S is aligned at 8k boundary and this gets linked
index 806d381947bf1c704dc584e5b29360abb7b40a88..b25121b537d8dfb6d0588d1aaf4ebc9b915cc663 100644 (file)
 #include "linux/mqueue.h"
 #include "asm/uaccess.h"
 
-struct mm_struct init_mm = INIT_MM(init_mm);
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-EXPORT_SYMBOL(init_mm);
-
 /*
  * Initial task structure.
  *
index df3bf269beab96466785764b619bc737fd0f5d55..270ff83efc11d8dc27089a3fec085fdec9074b5b 100644 (file)
@@ -12,7 +12,6 @@
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
 
 /*
  * Initial thread structure.
index e07f5c9fcd3500727efdd0a734b4cfcf654412fc..c4302f0e4ba08a66b39023d13986dda288a4f487 100644 (file)
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
 union thread_union init_thread_union
        __attribute__((__section__(".data.init_task"))) =
 { INIT_THREAD_INFO(init_task) };
index 28b1f30601b555d6f12532a9223428244dad7e87..5368fbdc78018c573c9f20a1dab76adbc8cb0f24 100644 (file)
 extern struct files_struct init_files;
 extern struct fs_struct init_fs;
 
-#define INIT_MM(name) \
-{                                                              \
-       .mm_rb          = RB_ROOT,                              \
-       .pgd            = swapper_pg_dir,                       \
-       .mm_users       = ATOMIC_INIT(2),                       \
-       .mm_count       = ATOMIC_INIT(1),                       \
-       .mmap_sem       = __RWSEM_INITIALIZER(name.mmap_sem),   \
-       .page_table_lock =  __SPIN_LOCK_UNLOCKED(name.page_table_lock), \
-       .mmlist         = LIST_HEAD_INIT(name.mmlist),          \
-       .cpu_vm_mask    = CPU_MASK_ALL,                         \
-}
-
 #define INIT_SIGNALS(sig) {                                            \
        .count          = ATOMIC_INIT(1),                               \
        .wait_chldexit  = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
index e89acb090b4dfe7c24aefc846ad492bb157fcbc6..cf76be785add4cd4112628fb9761159f223f5798 100644 (file)
@@ -12,6 +12,7 @@ obj-y                 := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
                           readahead.o swap.o truncate.o vmscan.o shmem.o \
                           prio_tree.o util.o mmzone.o vmstat.o backing-dev.o \
                           page_isolation.o mm_init.o $(mmu-y)
+obj-y += init-mm.o
 
 obj-$(CONFIG_PROC_PAGE_MONITOR) += pagewalk.o
 obj-$(CONFIG_BOUNCE)   += bounce.o
diff --git a/mm/init-mm.c b/mm/init-mm.c
new file mode 100644 (file)
index 0000000..57aba0d
--- /dev/null
@@ -0,0 +1,20 @@
+#include <linux/mm_types.h>
+#include <linux/rbtree.h>
+#include <linux/rwsem.h>
+#include <linux/spinlock.h>
+#include <linux/list.h>
+#include <linux/cpumask.h>
+
+#include <asm/atomic.h>
+#include <asm/pgtable.h>
+
+struct mm_struct init_mm = {
+       .mm_rb          = RB_ROOT,
+       .pgd            = swapper_pg_dir,
+       .mm_users       = ATOMIC_INIT(2),
+       .mm_count       = ATOMIC_INIT(1),
+       .mmap_sem       = __RWSEM_INITIALIZER(init_mm.mmap_sem),
+       .page_table_lock =  __SPIN_LOCK_UNLOCKED(init_mm.page_table_lock),
+       .mmlist         = LIST_HEAD_INIT(init_mm.mmlist),
+       .cpu_vm_mask    = CPU_MASK_ALL,
+};