Commit 212a0a6f authored by David Rientjes's avatar David Rientjes Committed by Linus Torvalds

mm, mempolicy: remove duplicate code

Remove some duplicate code and simplify alloc_pages_vma().  No functional
change.
Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6f6313d4
...@@ -1907,7 +1907,6 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, ...@@ -1907,7 +1907,6 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
unsigned long addr, int node) unsigned long addr, int node)
{ {
struct mempolicy *pol; struct mempolicy *pol;
struct zonelist *zl;
struct page *page; struct page *page;
unsigned int cpuset_mems_cookie; unsigned int cpuset_mems_cookie;
...@@ -1926,23 +1925,11 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, ...@@ -1926,23 +1925,11 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
return page; return page;
} }
zl = policy_zonelist(gfp, pol, node); page = __alloc_pages_nodemask(gfp, order,
if (unlikely(mpol_needs_cond_ref(pol))) { policy_zonelist(gfp, pol, node),
/*
* slow path: ref counted shared policy
*/
struct page *page = __alloc_pages_nodemask(gfp, order,
zl, policy_nodemask(gfp, pol));
__mpol_put(pol);
if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page))
goto retry_cpuset;
return page;
}
/*
* fast path: default or task policy
*/
page = __alloc_pages_nodemask(gfp, order, zl,
policy_nodemask(gfp, pol)); policy_nodemask(gfp, pol));
if (unlikely(mpol_needs_cond_ref(pol)))
__mpol_put(pol);
if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page)) if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page))
goto retry_cpuset; goto retry_cpuset;
return page; return page;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment