Commit b7ba30c679ed1eb7ed3ed8f281f6493282042bd4
Committed by
Linus Torvalds
1 parent
ff7ea79cf7
Exists in
master
and in
7 other branches
hugetlb: factor out prep_new_huge_page
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>
Showing 1 changed file with 11 additions and 6 deletions Side-by-side Diff
mm/hugetlb.c
... | ... | @@ -513,6 +513,16 @@ |
513 | 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 | 526 | static struct page *alloc_fresh_huge_page_node(int nid) |
517 | 527 | { |
518 | 528 | struct page *page; |
... | ... | @@ -526,12 +536,7 @@ |
526 | 536 | __free_pages(page, HUGETLB_PAGE_ORDER); |
527 | 537 | return NULL; |
528 | 538 | } |
529 | - set_compound_page_dtor(page, free_huge_page); | |
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 */ | |
539 | + prep_new_huge_page(page, nid); | |
535 | 540 | } |
536 | 541 | |
537 | 542 | return page; |