Commit b7ba30c6 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

hugetlb: factor out prep_new_huge_page

Needed to avoid code duplication in follow up patches.
Acked-by: default avatarAdam Litke <agl@us.ibm.com>
Acked-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ff7ea79c
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment