Skip to content

Commit

Permalink
mm: consolidate init_mm definition
Browse files Browse the repository at this point in the history
* 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.

[[email protected]: add missing #includes]
Signed-off-by: Alexey Dobriyan <[email protected]>
Cc: Mike Frysinger <[email protected]>
Cc: Americo Wang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and torvalds committed Jun 17, 2009
1 parent 3b0fde0 commit bb1f17b
Show file tree
Hide file tree
Showing 24 changed files with 21 additions and 88 deletions.
3 changes: 0 additions & 3 deletions arch/alpha/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

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
Expand Down
4 changes: 0 additions & 4 deletions arch/arm/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,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.
*
Expand Down
4 changes: 0 additions & 4 deletions arch/avr32/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,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. Must be aligned on an 8192-byte boundary.
*/
Expand Down
4 changes: 0 additions & 4 deletions arch/blackfin/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,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 task structure.
*
Expand Down
4 changes: 0 additions & 4 deletions arch/cris/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,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.
*
Expand Down
4 changes: 0 additions & 4 deletions arch/frv/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +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);

EXPORT_SYMBOL(init_mm);

/*
* Initial thread structure.
*
Expand Down
4 changes: 0 additions & 4 deletions arch/h8300/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,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 task structure.
*
Expand Down
4 changes: 0 additions & 4 deletions arch/ia64/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,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 task structure.
*
Expand Down
4 changes: 0 additions & 4 deletions arch/m32r/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,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.
*
Expand Down
4 changes: 0 additions & 4 deletions arch/m68k/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,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);

union thread_union init_thread_union
__attribute__((section(".data.init_task"), aligned(THREAD_SIZE)))
= { INIT_THREAD_INFO(init_task) };
Expand Down
4 changes: 0 additions & 4 deletions arch/m68knommu/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,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 task structure.
*
Expand Down
4 changes: 0 additions & 4 deletions arch/mips/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,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.
*
Expand Down
3 changes: 0 additions & 3 deletions arch/mn10300/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
4 changes: 0 additions & 4 deletions arch/parisc/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,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 task structure.
*
Expand Down
4 changes: 0 additions & 4 deletions arch/powerpc/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
4 changes: 0 additions & 4 deletions arch/s390/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,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.
*
Expand Down
3 changes: 0 additions & 3 deletions arch/sh/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
3 changes: 0 additions & 3 deletions arch/sparc/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

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
Expand Down
3 changes: 0 additions & 3 deletions arch/um/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
#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.
*
Expand Down
1 change: 0 additions & 1 deletion arch/x86/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 0 additions & 4 deletions arch/xtensa/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,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);

union thread_union init_thread_union
__attribute__((__section__(".data.init_task"))) =
{ INIT_THREAD_INFO(init_task) };
Expand Down
12 changes: 0 additions & 12 deletions include/linux/init_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,6 @@
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),\
Expand Down
1 change: 1 addition & 0 deletions mm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions mm/init-mm.c
Original file line number Diff line number Diff line change
@@ -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,
};

0 comments on commit bb1f17b

Please sign in to comment.