diff options
author | David Rientjes <rientjes@google.com> | 2011-01-13 18:46:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 20:32:34 -0500 |
commit | d0a21265dfb5fa8ae54e90d0fb6d1c215b10a28a (patch) | |
tree | a3bf2c96ad8e180f32a52e208667a40bb972275b /arch/mips | |
parent | ec3f64fc9c196a304c4b7db3e1ff56d640628509 (diff) |
mm: unify module_alloc code for vmalloc
Four architectures (arm, mips, sparc, x86) use __vmalloc_area() for
module_init(). Much of the code is duplicated and can be generalized in a
globally accessible function, __vmalloc_node_range().
__vmalloc_node() now calls into __vmalloc_node_range() with a range of
[VMALLOC_START, VMALLOC_END) for functionally equivalent behavior.
Each architecture may then use __vmalloc_node_range() directly to remove
the duplication of code.
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/kernel/module.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c index 6f51dda87fce..d87a72e9fac7 100644 --- a/arch/mips/kernel/module.c +++ b/arch/mips/kernel/module.c | |||
@@ -46,17 +46,9 @@ static DEFINE_SPINLOCK(dbe_lock); | |||
46 | void *module_alloc(unsigned long size) | 46 | void *module_alloc(unsigned long size) |
47 | { | 47 | { |
48 | #ifdef MODULE_START | 48 | #ifdef MODULE_START |
49 | struct vm_struct *area; | 49 | return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END, |
50 | 50 | GFP_KERNEL, PAGE_KERNEL, -1, | |
51 | size = PAGE_ALIGN(size); | 51 | __builtin_return_address(0)); |
52 | if (!size) | ||
53 | return NULL; | ||
54 | |||
55 | area = __get_vm_area(size, VM_ALLOC, MODULE_START, MODULE_END); | ||
56 | if (!area) | ||
57 | return NULL; | ||
58 | |||
59 | return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL); | ||
60 | #else | 52 | #else |
61 | if (size == 0) | 53 | if (size == 0) |
62 | return NULL; | 54 | return NULL; |