diff options
-rw-r--r-- | mm/hugetlb.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index eda9642254a0..32dff4290c66 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -513,6 +513,16 @@ static int adjust_pool_surplus(int delta) | |||
513 | return ret; | 513 | return ret; |
514 | } | 514 | } |
515 | 515 | ||
516 | static void prep_new_huge_page(struct page *page, int nid) | ||
517 | { | ||
518 | set_compound_page_dtor(page, free_huge_page); | ||
519 | spin_lock(&hugetlb_lock); | ||
520 | nr_huge_pages++; | ||
521 | nr_huge_pages_node[nid]++; | ||
522 | spin_unlock(&hugetlb_lock); | ||
523 | put_page(page); /* free it into the hugepage allocator */ | ||
524 | } | ||
525 | |||
516 | static struct page *alloc_fresh_huge_page_node(int nid) | 526 | static struct page *alloc_fresh_huge_page_node(int nid) |
517 | { | 527 | { |
518 | struct page *page; | 528 | struct page *page; |
@@ -526,12 +536,7 @@ static struct page *alloc_fresh_huge_page_node(int nid) | |||
526 | __free_pages(page, HUGETLB_PAGE_ORDER); | 536 | __free_pages(page, HUGETLB_PAGE_ORDER); |
527 | return NULL; | 537 | return NULL; |
528 | } | 538 | } |
529 | set_compound_page_dtor(page, free_huge_page); | 539 | prep_new_huge_page(page, nid); |
530 | spin_lock(&hugetlb_lock); | ||
531 | nr_huge_pages++; | ||
532 | nr_huge_pages_node[nid]++; | ||
533 | spin_unlock(&hugetlb_lock); | ||
534 | put_page(page); /* free it into the hugepage allocator */ | ||
535 | } | 540 | } |
536 | 541 | ||
537 | return page; | 542 | return page; |