All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Dobson <colpatch@us.ibm.com>
To: Linus Torvalds <torvalds@transmeta.com>,
	Andrew Morton <akpm@digeo.com>, Martin Bligh <mjbligh@us.ibm.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>, linux-mm@kvack.org
Subject: [rfc][patch] clean up redundant code for alloc_pages
Date: Fri, 21 Feb 2003 16:31:54 -0800	[thread overview]
Message-ID: <3E56C4FA.8010400@us.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

Well, alloc_pages() and alloc_pages_node() look *REAAALY* similar.  This 
is a really small patch to just shrink alloc_pages_node() a bit and 
point alloc_page() and alloc_pages() at alloc_pages_node() with the 
appropriate arguments.

It is a pretty trivial change, just curious if there are any violent 
objections to such a change.

[mcd@arrakis push]$ diffstat alloc_pages_cleanup-2.5.62.patch
  gfp.h |   18 +++++-------------
  1 files changed, 5 insertions(+), 13 deletions(-)

Cheers!

-Matt

[-- Attachment #2: alloc_pages_cleanup-2.5.62.patch --]
[-- Type: text/plain, Size: 1528 bytes --]

diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.62-vanilla/include/linux/gfp.h linux-2.5.62-alloc_pages/include/linux/gfp.h
--- linux-2.5.62-vanilla/include/linux/gfp.h	Mon Feb 17 14:56:09 2003
+++ linux-2.5.62-alloc_pages/include/linux/gfp.h	Fri Feb 21 16:15:59 2003
@@ -49,24 +49,16 @@
 extern struct page * FASTCALL(__alloc_pages(unsigned int, unsigned int, struct zonelist *));
 static inline struct page * alloc_pages_node(int nid, unsigned int gfp_mask, unsigned int order)
 {
-	struct pglist_data *pgdat = NODE_DATA(nid);
-	unsigned int idx = (gfp_mask & GFP_ZONEMASK);
-
 	if (unlikely(order >= MAX_ORDER))
 		return NULL;
-	return __alloc_pages(gfp_mask, order, pgdat->node_zonelists + idx);
-}
-static inline struct page * alloc_pages(unsigned int gfp_mask, unsigned int order)
-{
-	struct pglist_data *pgdat = NODE_DATA(numa_node_id());
-	unsigned int idx = (gfp_mask & GFP_ZONEMASK);
 
-	if (unlikely(order >= MAX_ORDER))
-		return NULL;
-	return __alloc_pages(gfp_mask, order, pgdat->node_zonelists + idx);
+	return __alloc_pages(gfp_mask, order, NODE_DATA(nid)->node_zonelists + (gfp_mask & GFP_ZONEMASK));
 }
 
-#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
+#define alloc_pages(gfp_mask, order) \
+		alloc_pages_node(numa_node_id(), gfp_mask, order)
+#define alloc_page(gfp_mask) \
+		alloc_pages_node(numa_node_id(), gfp_mask, 0)
 
 extern unsigned long FASTCALL(__get_free_pages(unsigned int gfp_mask, unsigned int order));
 extern unsigned long FASTCALL(get_zeroed_page(unsigned int gfp_mask));

                 reply	other threads:[~2003-02-22  0:29 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=3E56C4FA.8010400@us.ibm.com \
    --to=colpatch@us.ibm.com \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mjbligh@us.ibm.com \
    --cc=torvalds@transmeta.com \
    /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 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.