aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mm.h
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2006-09-26 02:31:55 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 11:48:52 -0400
commit89fa30242facca249aead2aac03c4c69764f911c (patch)
tree1ac46b4777b819f2a4793d8e37330576ae5089ec /include/linux/mm.h
parent4415cc8df630b05d3a54267d5f3e5c0b63a4ec05 (diff)
[PATCH] NUMA: Add zone_to_nid function
There are many places where we need to determine the node of a zone. Currently we use a difficult to read sequence of pointer dereferencing. Put that into an inline function and use throughout VM. Maybe we can find a way to optimize the lookup in the future. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index f2018775b995..856f0ee7e84a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -499,12 +499,17 @@ static inline struct zone *page_zone(struct page *page)
499 return zone_table[page_zone_id(page)]; 499 return zone_table[page_zone_id(page)];
500} 500}
501 501
502static inline unsigned long zone_to_nid(struct zone *zone)
503{
504 return zone->zone_pgdat->node_id;
505}
506
502static inline unsigned long page_to_nid(struct page *page) 507static inline unsigned long page_to_nid(struct page *page)
503{ 508{
504 if (FLAGS_HAS_NODE) 509 if (FLAGS_HAS_NODE)
505 return (page->flags >> NODES_PGSHIFT) & NODES_MASK; 510 return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
506 else 511 else
507 return page_zone(page)->zone_pgdat->node_id; 512 return zone_to_nid(page_zone(page));
508} 513}
509static inline unsigned long page_to_section(struct page *page) 514static inline unsigned long page_to_section(struct page *page)
510{ 515{