From: Joonsoo Kim Date: Wed, 11 Sep 2013 21:20:50 +0000 (-0700) Subject: mm, hugetlb: move up the code which check availability of free huge page X-Git-Tag: upstream/snapshot3+hdmi~4342^2~244 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9966c4bbb110003ee218c5c4df583041b57027c4;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git mm, hugetlb: move up the code which check availability of free huge page In this time we are holding a hugetlb_lock, so hstate values can't be changed. If we don't have any usable free huge page in this time, we don't need to proceed with the processing. So move this code up. Signed-off-by: Joonsoo Kim Acked-by: Michal Hocko Reviewed-by: Wanpeng Li Reviewed-by: Aneesh Kumar K.V Cc: Aneesh Kumar K.V Acked-by: Hillf Danton Cc: Naoya Horiguchi Cc: Rik van Riel Cc: Mel Gorman Cc: KAMEZAWA Hiroyuki Cc: Hugh Dickins Cc: Davidlohr Bueso Cc: David Gibson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 6e51483..a879035 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -539,10 +539,6 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, struct zoneref *z; unsigned int cpuset_mems_cookie; -retry_cpuset: - cpuset_mems_cookie = get_mems_allowed(); - zonelist = huge_zonelist(vma, address, - htlb_alloc_mask, &mpol, &nodemask); /* * A child process with MAP_PRIVATE mappings created by their parent * have no page reserves. This check ensures that reservations are @@ -556,6 +552,11 @@ retry_cpuset: if (avoid_reserve && h->free_huge_pages - h->resv_huge_pages == 0) goto err; +retry_cpuset: + cpuset_mems_cookie = get_mems_allowed(); + zonelist = huge_zonelist(vma, address, + htlb_alloc_mask, &mpol, &nodemask); + for_each_zone_zonelist_nodemask(zone, z, zonelist, MAX_NR_ZONES - 1, nodemask) { if (cpuset_zone_allowed_softwall(zone, htlb_alloc_mask)) { @@ -574,7 +575,6 @@ retry_cpuset: return page; err: - mpol_cond_put(mpol); return NULL; }