mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-02 20:29:20 +00:00
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>
This commit is contained in:
parent
91ca918648
commit
d26914d117
8 changed files with 38 additions and 39 deletions
|
@ -540,7 +540,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h,
|
|||
goto err;
|
||||
|
||||
retry_cpuset:
|
||||
cpuset_mems_cookie = get_mems_allowed();
|
||||
cpuset_mems_cookie = read_mems_allowed_begin();
|
||||
zonelist = huge_zonelist(vma, address,
|
||||
htlb_alloc_mask(h), &mpol, &nodemask);
|
||||
|
||||
|
@ -562,7 +562,7 @@ retry_cpuset:
|
|||
}
|
||||
|
||||
mpol_cond_put(mpol);
|
||||
if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page))
|
||||
if (unlikely(!page && read_mems_allowed_retry(cpuset_mems_cookie)))
|
||||
goto retry_cpuset;
|
||||
return page;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue