From: Oleg Nesterov <oleg@tv-sign.ru>
To: linux-kernel@vger.kernel.org
Cc: Andi Kleen <ak@suse.de>, "David S. Miller" <davem@davemloft.net>,
Russell King <rmk@arm.linux.org.uk>,
Rusty Russell <rusty@rustcorp.com.au>,
Andrew Morton <akpm@osdl.org>
Subject: [PATCH 2/5] vmalloc: use __vmalloc_area in arch/arm
Date: Sun, 06 Mar 2005 21:56:38 +0300 [thread overview]
Message-ID: <422B5266.F70CFD84@tv-sign.ru> (raw)
Replace open coded __vmalloc() with __vmalloc_area().
Uncompiled, untested.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 2.6.11/arch/arm/kernel/module.c~ 2005-03-06 18:21:21.000000000 +0300
+++ 2.6.11/arch/arm/kernel/module.c 2005-03-06 20:14:40.000000000 +0300
@@ -35,44 +35,16 @@ extern void _etext;
void *module_alloc(unsigned long size)
{
struct vm_struct *area;
- struct page **pages;
- unsigned int array_size, i;
size = PAGE_ALIGN(size);
if (!size)
- goto out_null;
+ return NULL;
area = __get_vm_area(size, VM_ALLOC, MODULE_START, MODULE_END);
if (!area)
- goto out_null;
+ return NULL;
- area->nr_pages = size >> PAGE_SHIFT;
- array_size = area->nr_pages * sizeof(struct page *);
- area->pages = pages = kmalloc(array_size, GFP_KERNEL);
- if (!area->pages) {
- remove_vm_area(area->addr);
- kfree(area);
- goto out_null;
- }
-
- memset(pages, 0, array_size);
-
- for (i = 0; i < area->nr_pages; i++) {
- pages[i] = alloc_page(GFP_KERNEL);
- if (unlikely(!pages[i])) {
- area->nr_pages = i;
- goto out_no_pages;
- }
- }
-
- if (map_vm_area(area, PAGE_KERNEL, &pages))
- goto out_no_pages;
- return area->addr;
-
- out_no_pages:
- vfree(area->addr);
- out_null:
- return NULL;
+ return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL);
}
void module_free(struct module *module, void *region)
reply other threads:[~2005-03-06 17:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=422B5266.F70CFD84@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®