aboutsummaryrefslogtreecommitdiffstats
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2014-04-03 17:47:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-03 19:20:58 -0400
commitd26914d11751b23ca2e8747725f2cae10c2f2c1b (patch)
tree020b606fb9223e29292f54922a11111239e3a3f4 /mm/hugetlb.c
parent91ca9186484809c57303b33778d841cc28f696ed (diff)
mm: optimize put_mems_allowed() usage
Since put_mems_allowed() is strictly optional, its a seqcount retry, we don't need to evaluate the function if the allocation was in fact successful, saving a smp_rmb some loads and comparisons on some relative fast-paths. Since the naming, get/put_mems_allowed() does suggest a mandatory pairing, rename the interface, as suggested by Mel, to resemble the seqcount interface. This gives us: read_mems_allowed_begin() and read_mems_allowed_retry(), where it is important to note that the return value of the latter call is inverted from its previous incarnation. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Mel Gorman <mgorman@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index c01cb9fedb18..139b7462203b 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -540,7 +540,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h,
540 goto err; 540 goto err;
541 541
542retry_cpuset: 542retry_cpuset:
543 cpuset_mems_cookie = get_mems_allowed(); 543 cpuset_mems_cookie = read_mems_allowed_begin();
544 zonelist = huge_zonelist(vma, address, 544 zonelist = huge_zonelist(vma, address,
545 htlb_alloc_mask(h), &mpol, &nodemask); 545 htlb_alloc_mask(h), &mpol, &nodemask);
546 546
@@ -562,7 +562,7 @@ retry_cpuset:
562 } 562 }
563 563
564 mpol_cond_put(mpol); 564 mpol_cond_put(mpol);
565 if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page)) 565 if (unlikely(!page && read_mems_allowed_retry(cpuset_mems_cookie)))
566 goto retry_cpuset; 566 goto retry_cpuset;
567 return page; 567 return page;
568 568