From: Christoph Lameter <clameter@sgi.com>

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>
---

 mm/swap_prefetch.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff -puN mm/swap_prefetch.c~numa-add-zone_to_nid-function-swap_prefetch mm/swap_prefetch.c
--- a/mm/swap_prefetch.c~numa-add-zone_to_nid-function-swap_prefetch
+++ a/mm/swap_prefetch.c
@@ -275,7 +275,7 @@ static void examine_free_limits(void)
 		if (!populated_zone(z))
 			continue;
 
-		ns = &sp_stat.node[z->zone_pgdat->node_id];
+		ns = &sp_stat.node[zone_to_nid(z)];
 		idx = zone_idx(z);
 		ns->lowfree[idx] = z->pages_high * 3;
 		ns->highfree[idx] = ns->lowfree[idx] + z->pages_high;
@@ -333,7 +333,7 @@ static int prefetch_suitable(void)
 		if (!populated_zone(z))
 			continue;
 
-		node = z->zone_pgdat->node_id;
+		node = zone_to_nid(z);
 		ns = &sp_stat.node[node];
 		idx = zone_idx(z);
 
@@ -557,7 +557,7 @@ void __init prepare_swap_prefetch(void)
 		if (!present)
 			continue;
 
-		ns = &sp_stat.node[zone->zone_pgdat->node_id];
+		ns = &sp_stat.node[zone_to_nid(zone)];
 		ns->prefetch_watermark += present / 3 * 2;
 		idx = zone_idx(zone);
 		ns->pointfree[idx] = &ns->highfree[idx];
_
