[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>
This commit is contained in:
Christoph Lameter 2006-09-25 23:31:55 -07:00 committed by Linus Torvalds
parent 4415cc8df6
commit 89fa30242f
9 changed files with 17 additions and 13 deletions

View file

@ -499,12 +499,17 @@ static inline struct zone *page_zone(struct page *page)
return zone_table[page_zone_id(page)];
}
static inline unsigned long zone_to_nid(struct zone *zone)
{
return zone->zone_pgdat->node_id;
}
static inline unsigned long page_to_nid(struct page *page)
{
if (FLAGS_HAS_NODE)
return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
else
return page_zone(page)->zone_pgdat->node_id;
return zone_to_nid(page_zone(page));
}
static inline unsigned long page_to_section(struct page *page)
{