]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
hugetlb: factor out prep_new_huge_page
authorAndi Kleen <ak@suse.de>
Thu, 24 Jul 2008 04:27:40 +0000 (21:27 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Jul 2008 17:47:17 +0000 (10:47 -0700)
Needed to avoid code duplication in follow up patches.

Acked-by: Adam Litke <agl@us.ibm.com>
Acked-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/hugetlb.c

index eda9642254a06cfcb507f71593d76ec48611b22e..32dff4290c66ede5e8fea935b7242e78b7d11928 100644 (file)
@@ -513,6 +513,16 @@ static int adjust_pool_surplus(int delta)
        return ret;
 }
 
+static void prep_new_huge_page(struct page *page, int nid)
+{
+       set_compound_page_dtor(page, free_huge_page);
+       spin_lock(&hugetlb_lock);
+       nr_huge_pages++;
+       nr_huge_pages_node[nid]++;
+       spin_unlock(&hugetlb_lock);
+       put_page(page); /* free it into the hugepage allocator */
+}
+
 static struct page *alloc_fresh_huge_page_node(int nid)
 {
        struct page *page;
@@ -526,12 +536,7 @@ static struct page *alloc_fresh_huge_page_node(int nid)
                        __free_pages(page, HUGETLB_PAGE_ORDER);
                        return NULL;
                }
-               set_compound_page_dtor(page, free_huge_page);
-               spin_lock(&hugetlb_lock);
-               nr_huge_pages++;
-               nr_huge_pages_node[nid]++;
-               spin_unlock(&hugetlb_lock);
-               put_page(page); /* free it into the hugepage allocator */
+               prep_new_huge_page(page, nid);
        }
 
        return page;