linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Bob Liu <lliubbo@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, mel@csn.ul.ie, cl@linux-foundation.org,
	kosaki.motohiro@jp.fujitsu.com, penberg@cs.helsinki.fi,
	lethal@linux-sh.org, a.p.zijlstra@chello.nl,
	nickpiggin@yahoo.com.au, dave@linux.vnet.ibm.com,
	lee.schermerhorn@hp.com, rientjes@google.com,
	minchan.kim@gmail.com, Bob Liu <lliubbo@gmail.com>
Subject: [PATCH] add alloc_pages_exact_node()
Date: Sat, 10 Apr 2010 19:49:33 +0800	[thread overview]
Message-ID: <1270900173-10695-2-git-send-email-lliubbo@gmail.com> (raw)
In-Reply-To: <1270900173-10695-1-git-send-email-lliubbo@gmail.com>

Add alloc_pages_exact_node() to allocate pages from exact
node.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
---
 arch/powerpc/platforms/cell/ras.c |    4 ++--
 include/linux/gfp.h               |    7 +++++++
 mm/mempolicy.c                    |    2 +-
 mm/migrate.c                      |    3 +--
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c
index 6d32594..93a5afd 100644
--- a/arch/powerpc/platforms/cell/ras.c
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -123,8 +123,8 @@ static int __init cbe_ptcal_enable_on_node(int nid, int order)
 
 	area->nid = nid;
 	area->order = order;
-	area->pages = alloc_pages_from_valid_node(area->nid,
-			GFP_KERNEL | GFP_THISNODE, area->order);
+	area->pages = alloc_pages_exact_node(area->nid, GFP_KERNEL,
+				area->order);
 
 	if (!area->pages) {
 		printk(KERN_WARNING "%s: no page on node %d\n",
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index c94f2ed..70cf2ae 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -296,6 +296,13 @@ static inline struct page *alloc_pages_from_valid_node(int nid, gfp_t gfp_mask,
 	return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
 }
 
+static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask,
+						unsigned int order)
+{
+	return alloc_pages_from_valid_node(nid, gfp_mask | GFP_THISNODE,
+			order);
+}
+
 #ifdef CONFIG_NUMA
 extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order);
 
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 6838cd8..08f40a2 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -842,7 +842,7 @@ static void migrate_page_add(struct page *page, struct list_head *pagelist,
 
 static struct page *new_node_page(struct page *page, unsigned long node, int **x)
 {
-	return alloc_pages_from_valid_node(node, GFP_HIGHUSER_MOVABLE, 0);
+	return alloc_pages_exact_node(node, GFP_HIGHUSER_MOVABLE, 0);
 }
 
 /*
diff --git a/mm/migrate.c b/mm/migrate.c
index a057a1a..17330c5 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -770,8 +770,7 @@ static struct page *new_page_node(struct page *p, unsigned long private,
 
 	*result = &pm->status;
 
-	return alloc_pages_from_valid_node(pm->node,
-				GFP_HIGHUSER_MOVABLE | GFP_THISNODE, 0);
+	return alloc_pages_exact_node(pm->node, GFP_HIGHUSER_MOVABLE, 0);
 }
 
 /*
-- 
1.5.6.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-04-10 11:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-10 11:49 [PATCH] code clean rename alloc_pages_exact_node() Bob Liu
2010-04-10 11:49 ` Bob Liu [this message]
2010-04-12  3:38   ` [PATCH] add alloc_pages_exact_node() Minchan Kim
2010-04-12  3:43     ` Bob Liu
2010-04-12 16:38   ` Mel Gorman
2010-04-12  3:34 ` [PATCH] code clean rename alloc_pages_exact_node() Minchan Kim
2010-04-12  3:40   ` Bob Liu
2010-04-12 16:43 ` Mel Gorman
2010-04-13  4:34   ` Minchan Kim
2010-04-13  5:40     ` KAMEZAWA Hiroyuki
2010-04-13  7:09       ` Bob Liu
2010-04-13  7:32         ` KAMEZAWA Hiroyuki
2010-04-13  7:53           ` Minchan Kim
2010-04-13  7:37         ` Minchan Kim
2010-04-13  7:40         ` Minchan Kim
2010-04-13  8:27         ` Mel Gorman
2010-04-16 16:20           ` Christoph Lameter
2010-04-16 16:15         ` 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=1270900173-10695-2-git-send-email-lliubbo@gmail.com \
    --to=lliubbo@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=lee.schermerhorn@hp.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=minchan.kim@gmail.com \
    --cc=nickpiggin@yahoo.com.au \
    --cc=penberg@cs.helsinki.fi \
    --cc=rientjes@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).