]> git.hungrycats.org Git - linux/commitdiff
[PATCH] use page_to_nid
authorAndy Whitcroft <apw@shadowen.org>
Tue, 31 Aug 2004 03:37:17 +0000 (20:37 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 31 Aug 2004 03:37:17 +0000 (20:37 -0700)
There are a couple of places where we seem to go round the houses to get
the numa node id from a page.  We have a macro for this so it seems
sensible to use that.

Both lookup_node and enqueue_huge_page use page_zone() to locate the zone,
that to locate node pgdat_t and that to get the node_id.  Its more
efficient to use page_to_nid() which gets the nid from the page flags,
especially if we are not using the zone for anything else it.  Change these
to use page_to_nid().

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/hugetlb.c
mm/mempolicy.c

index 3c96ecf1b5a1e589d8aaf4de672d3d1244bd39e5..872fb7fc329d0e2e62d5058d67449dc16dca1b8e 100644 (file)
@@ -21,7 +21,7 @@ static spinlock_t hugetlb_lock = SPIN_LOCK_UNLOCKED;
 
 static void enqueue_huge_page(struct page *page)
 {
-       int nid = page_zone(page)->zone_pgdat->node_id;
+       int nid = page_to_nid(page);
        list_add(&page->lru, &hugepage_freelists[nid]);
        free_huge_pages++;
        free_huge_pages_node[nid]++;
index caaa6c34ae44b6296083bcd936abbe9afc6b41b8..ea806adcda8e359093f4be27e3955d3333eb9650 100644 (file)
@@ -437,7 +437,7 @@ static int lookup_node(struct mm_struct *mm, unsigned long addr)
 
        err = get_user_pages(current, mm, addr & PAGE_MASK, 1, 0, 0, &p, NULL);
        if (err >= 0) {
-               err = page_zone(p)->zone_pgdat->node_id;
+               err = page_to_nid(p);
                put_page(p);
        }
        return err;