From: Pavel Machek <pavel@ucw.cz>
To: Andrew Morton <akpm@osdl.org>,
kernel list <linux-kernel@vger.kernel.org>
Subject: mm/page_alloc.c: remove hand-coded get_order()
Date: Tue, 15 Apr 2008 11:23:27 +0200 [thread overview]
Message-ID: <20080415092317.GA1529@elf.ucw.cz> (raw)
__get_free_pages() is strange interface:
It has underscores, yet get_free_pages() does not exists.
It returns long when most people need pointer.
(And it takes order, when many people want to pass size).
What about creating void *get_free_pages(flags, order) version, then
slowly converting users to it?
Pavel
---
Remove hand-coded get_order() from page_alloc.c.
Signed-off-by: Pavel Machek <pavel@suse.cz>
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 402a504..c48aa45 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4339,9 +4339,7 @@ void *__init alloc_large_system_hash(con
else if (hashdist)
table = __vmalloc(size, GFP_ATOMIC, PAGE_KERNEL);
else {
- unsigned long order;
- for (order = 0; ((1UL << order) << PAGE_SHIFT) < size; order++)
- ;
+ unsigned long order = get_order(size);
table = (void*) __get_free_pages(GFP_ATOMIC, order);
/*
* If bucketsize is not a power-of-two, we may free
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next reply other threads:[~2008-04-15 9:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-15 9:23 Pavel Machek [this message]
2008-04-15 9:35 ` Andrew Morton
2008-04-15 9:38 ` Andrew Morton
2008-04-15 10:39 ` Andi Kleen
2008-04-16 19:18 ` Christoph Lameter
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=20080415092317.GA1529@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/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
Powered by JetHome