All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Consolidate init_mm definition
@ 2009-03-26 23:51 Alexey Dobriyan
  2009-03-27  0:05 ` Mike Frysinger
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Alexey Dobriyan @ 2009-03-26 23:51 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

* 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.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 arch/alpha/kernel/init_task.c     |    3 ---
 arch/arm/kernel/init_task.c       |    4 ----
 arch/avr32/kernel/init_task.c     |    4 ----
 arch/blackfin/kernel/init_task.c  |    4 ----
 arch/cris/kernel/process.c        |    4 ----
 arch/frv/kernel/init_task.c       |    4 ----
 arch/h8300/kernel/init_task.c     |    4 ----
 arch/ia64/kernel/init_task.c      |    4 ----
 arch/m32r/kernel/init_task.c      |    4 ----
 arch/m68k/kernel/process.c        |    4 ----
 arch/m68knommu/kernel/init_task.c |    4 ----
 arch/mips/kernel/init_task.c      |    4 ----
 arch/mn10300/kernel/init_task.c   |    3 ---
 arch/parisc/kernel/init_task.c    |    4 ----
 arch/powerpc/kernel/init_task.c   |    4 ----
 arch/s390/kernel/init_task.c      |    4 ----
 arch/sh/kernel/init_task.c        |    3 ---
 arch/sparc/kernel/init_task.c     |    3 ---
 arch/um/kernel/init_task.c        |    3 ---
 arch/x86/kernel/init_task.c       |    1 -
 arch/xtensa/kernel/init_task.c    |    4 ----
 include/linux/init_task.h         |   12 ------------
 mm/Makefile                       |    1 +
 mm/init-mm.c                      |   13 +++++++++++++
 24 files changed, 14 insertions(+), 88 deletions(-)

--- a/arch/alpha/kernel/init_task.c
+++ b/arch/alpha/kernel/init_task.c
@@ -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
--- a/arch/arm/kernel/init_task.c
+++ b/arch/arm/kernel/init_task.c
@@ -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.
  *
--- a/arch/avr32/kernel/init_task.c
+++ b/arch/avr32/kernel/init_task.c
@@ -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.
  */
--- a/arch/blackfin/kernel/init_task.c
+++ b/arch/blackfin/kernel/init_task.c
@@ -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.
  *
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -39,10 +39,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.
  *
--- a/arch/frv/kernel/init_task.c
+++ b/arch/frv/kernel/init_task.c
@@ -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.
  *
--- a/arch/h8300/kernel/init_task.c
+++ b/arch/h8300/kernel/init_task.c
@@ -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.
  *
--- a/arch/ia64/kernel/init_task.c
+++ b/arch/ia64/kernel/init_task.c
@@ -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.
  *
--- a/arch/m32r/kernel/init_task.c
+++ b/arch/m32r/kernel/init_task.c
@@ -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.
  *
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -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) };
--- a/arch/m68knommu/kernel/init_task.c
+++ b/arch/m68knommu/kernel/init_task.c
@@ -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.
  *
--- a/arch/mips/kernel/init_task.c
+++ b/arch/mips/kernel/init_task.c
@@ -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.
  *
--- a/arch/mn10300/kernel/init_task.c
+++ b/arch/mn10300/kernel/init_task.c
@@ -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.
  *
--- a/arch/parisc/kernel/init_task.c
+++ b/arch/parisc/kernel/init_task.c
@@ -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.
  *
--- a/arch/powerpc/kernel/init_task.c
+++ b/arch/powerpc/kernel/init_task.c
@@ -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.
  *
--- a/arch/s390/kernel/init_task.c
+++ b/arch/s390/kernel/init_task.c
@@ -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.
  *
--- a/arch/sh/kernel/init_task.c
+++ b/arch/sh/kernel/init_task.c
@@ -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.
  *
--- a/arch/sparc/kernel/init_task.c
+++ b/arch/sparc/kernel/init_task.c
@@ -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
--- a/arch/um/kernel/init_task.c
+++ b/arch/um/kernel/init_task.c
@@ -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.
  *
--- a/arch/x86/kernel/init_task.c
+++ b/arch/x86/kernel/init_task.c
@@ -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.
--- a/arch/xtensa/kernel/init_task.c
+++ b/arch/xtensa/kernel/init_task.c
@@ -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) };
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -14,18 +14,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),\
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -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
new file mode 100644
--- /dev/null
+++ b/mm/init-mm.c
@@ -0,0 +1,13 @@
+#include <linux/mm_types.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,
+};

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Consolidate init_mm definition
  2009-03-26 23:51 [PATCH] Consolidate init_mm definition Alexey Dobriyan
@ 2009-03-27  0:05 ` Mike Frysinger
  2009-03-27  1:56   ` Alexey Dobriyan
  2009-03-29 16:38 ` Américo Wang
  2009-04-07 21:11 ` Andrew Morton
  2 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2009-03-27  0:05 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: akpm, linux-kernel

On Thu, Mar 26, 2009 at 19:51, Alexey Dobriyan wrote:
> new file mode 100644
> --- /dev/null
> +++ b/mm/init-mm.c
> @@ -0,0 +1,13 @@
> +#include <linux/mm_types.h>
> +#include <asm/pgtable.h>

shouldnt there be a short license blurb ?
/* Licensed under the GPL-2 or later. */
-mike

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Consolidate init_mm definition
  2009-03-27  0:05 ` Mike Frysinger
@ 2009-03-27  1:56   ` Alexey Dobriyan
  2009-03-27  3:54     ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Alexey Dobriyan @ 2009-03-27  1:56 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: akpm, linux-kernel

On Thu, Mar 26, 2009 at 08:05:05PM -0400, Mike Frysinger wrote:
> On Thu, Mar 26, 2009 at 19:51, Alexey Dobriyan wrote:
> > +++ b/mm/init-mm.c
> > @@ -0,0 +1,13 @@
> > +#include <linux/mm_types.h>
> > +#include <asm/pgtable.h>
> 
> shouldnt there be a short license blurb ?
> /* Licensed under the GPL-2 or later. */
> -mike

Why should it be? Even more, kernel is under GNU GPL 2, not "or later".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Consolidate init_mm definition
  2009-03-27  1:56   ` Alexey Dobriyan
@ 2009-03-27  3:54     ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2009-03-27  3:54 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: akpm, linux-kernel

On Thu, Mar 26, 2009 at 21:56, Alexey Dobriyan wrote:
> On Thu, Mar 26, 2009 at 08:05:05PM -0400, Mike Frysinger wrote:
>> On Thu, Mar 26, 2009 at 19:51, Alexey Dobriyan wrote:
>> > +++ b/mm/init-mm.c
>> > @@ -0,0 +1,13 @@
>> > +#include <linux/mm_types.h>
>> > +#include <asm/pgtable.h>
>>
>> shouldnt there be a short license blurb ?
>> /* Licensed under the GPL-2 or later. */
>
> Why should it be? Even more, kernel is under GNU GPL 2, not "or later".

my point was to put a blurb.  i frankly dont care about the exact license used.

also, the entire kernel is not under GPL-2 only.  some pieces are "or
later" while others are a completely different license (BSD variant).
-mike

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Consolidate init_mm definition
  2009-03-26 23:51 [PATCH] Consolidate init_mm definition Alexey Dobriyan
  2009-03-27  0:05 ` Mike Frysinger
@ 2009-03-29 16:38 ` Américo Wang
  2009-03-29 17:59   ` Alexey Dobriyan
  2009-04-07 21:11 ` Andrew Morton
  2 siblings, 1 reply; 7+ messages in thread
From: Américo Wang @ 2009-03-29 16:38 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: akpm, linux-kernel

On Fri, Mar 27, 2009 at 02:51:16AM +0300, Alexey Dobriyan wrote:
>* 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.
>

Nice patch!

I don't know if my reply is too late or not.
But, do we need a new C file just to hold the init_mm definition?

Thanks.

-- 
Do what you love, f**k the rest! F**k the regulations!
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Consolidate init_mm definition
  2009-03-29 16:38 ` Américo Wang
@ 2009-03-29 17:59   ` Alexey Dobriyan
  0 siblings, 0 replies; 7+ messages in thread
From: Alexey Dobriyan @ 2009-03-29 17:59 UTC (permalink / raw)
  To: Américo Wang; +Cc: akpm, linux-kernel

On Mon, Mar 30, 2009 at 12:38:57AM +0800, Américo Wang wrote:
> On Fri, Mar 27, 2009 at 02:51:16AM +0300, Alexey Dobriyan wrote:
> >* 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.
> >
> 
> Nice patch!
> 
> I don't know if my reply is too late or not.
> But, do we need a new C file just to hold the init_mm definition?

I dunno. I thought where could I stick it, and all files looked alien?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Consolidate init_mm definition
  2009-03-26 23:51 [PATCH] Consolidate init_mm definition Alexey Dobriyan
  2009-03-27  0:05 ` Mike Frysinger
  2009-03-29 16:38 ` Américo Wang
@ 2009-04-07 21:11 ` Andrew Morton
  2 siblings, 0 replies; 7+ messages in thread
From: Andrew Morton @ 2009-04-07 21:11 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: linux-kernel

On Fri, 27 Mar 2009 02:51:16 +0300
Alexey Dobriyan <adobriyan@gmail.com> wrote:

> --- /dev/null
> +++ b/mm/init-mm.c
> @@ -0,0 +1,13 @@
> +#include <linux/mm_types.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,
> +};

I'd be more conmfortable if this file were to explicitly include the
headers which it needs.

As it stands, variations in configs (especially different
architectures) have a decent chance of breaking things.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-04-07 21:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-26 23:51 [PATCH] Consolidate init_mm definition Alexey Dobriyan
2009-03-27  0:05 ` Mike Frysinger
2009-03-27  1:56   ` Alexey Dobriyan
2009-03-27  3:54     ` Mike Frysinger
2009-03-29 16:38 ` Américo Wang
2009-03-29 17:59   ` Alexey Dobriyan
2009-04-07 21:11 ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.