diff options
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r-- | mm/hugetlb.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 4c9e6bbf3772..54d42b009dbe 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -465,11 +465,13 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, | |||
465 | struct page *page = NULL; | 465 | struct page *page = NULL; |
466 | struct mempolicy *mpol; | 466 | struct mempolicy *mpol; |
467 | nodemask_t *nodemask; | 467 | nodemask_t *nodemask; |
468 | struct zonelist *zonelist = huge_zonelist(vma, address, | 468 | struct zonelist *zonelist; |
469 | htlb_alloc_mask, &mpol, &nodemask); | ||
470 | struct zone *zone; | 469 | struct zone *zone; |
471 | struct zoneref *z; | 470 | struct zoneref *z; |
472 | 471 | ||
472 | get_mems_allowed(); | ||
473 | zonelist = huge_zonelist(vma, address, | ||
474 | htlb_alloc_mask, &mpol, &nodemask); | ||
473 | /* | 475 | /* |
474 | * A child process with MAP_PRIVATE mappings created by their parent | 476 | * A child process with MAP_PRIVATE mappings created by their parent |
475 | * have no page reserves. This check ensures that reservations are | 477 | * have no page reserves. This check ensures that reservations are |
@@ -477,11 +479,11 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, | |||
477 | */ | 479 | */ |
478 | if (!vma_has_reserves(vma) && | 480 | if (!vma_has_reserves(vma) && |
479 | h->free_huge_pages - h->resv_huge_pages == 0) | 481 | h->free_huge_pages - h->resv_huge_pages == 0) |
480 | return NULL; | 482 | goto err; |
481 | 483 | ||
482 | /* If reserves cannot be used, ensure enough pages are in the pool */ | 484 | /* If reserves cannot be used, ensure enough pages are in the pool */ |
483 | if (avoid_reserve && h->free_huge_pages - h->resv_huge_pages == 0) | 485 | if (avoid_reserve && h->free_huge_pages - h->resv_huge_pages == 0) |
484 | return NULL; | 486 | goto err;; |
485 | 487 | ||
486 | for_each_zone_zonelist_nodemask(zone, z, zonelist, | 488 | for_each_zone_zonelist_nodemask(zone, z, zonelist, |
487 | MAX_NR_ZONES - 1, nodemask) { | 489 | MAX_NR_ZONES - 1, nodemask) { |
@@ -500,7 +502,9 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, | |||
500 | break; | 502 | break; |
501 | } | 503 | } |
502 | } | 504 | } |
505 | err: | ||
503 | mpol_cond_put(mpol); | 506 | mpol_cond_put(mpol); |
507 | put_mems_allowed(); | ||
504 | return page; | 508 | return page; |
505 | } | 509 | } |
506 | 510 | ||