提交 19800502 编写于 作者: B Bob Liu 提交者: Linus Torvalds

mempolicy: remove redundant check

Lee's patch "mempolicy: use MPOL_PREFERRED for system-wide default policy"
has made the MPOL_DEFAULT only used in the memory policy APIs.  So, no
need to check in __mpol_equal also.  Also get rid of mpol_match_intent()
and move its logic directly into __mpol_equal().
Signed-off-by: NBob Liu <lliubbo@gmail.com>
Acked-by: NDavid Rientjes <rientjes@google.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 6eb27e1f
...@@ -1787,16 +1787,6 @@ struct mempolicy *__mpol_cond_copy(struct mempolicy *tompol, ...@@ -1787,16 +1787,6 @@ struct mempolicy *__mpol_cond_copy(struct mempolicy *tompol,
return tompol; return tompol;
} }
static int mpol_match_intent(const struct mempolicy *a,
const struct mempolicy *b)
{
if (a->flags != b->flags)
return 0;
if (!mpol_store_user_nodemask(a))
return 1;
return nodes_equal(a->w.user_nodemask, b->w.user_nodemask);
}
/* Slow path of a mempolicy comparison */ /* Slow path of a mempolicy comparison */
int __mpol_equal(struct mempolicy *a, struct mempolicy *b) int __mpol_equal(struct mempolicy *a, struct mempolicy *b)
{ {
...@@ -1804,8 +1794,12 @@ int __mpol_equal(struct mempolicy *a, struct mempolicy *b) ...@@ -1804,8 +1794,12 @@ int __mpol_equal(struct mempolicy *a, struct mempolicy *b)
return 0; return 0;
if (a->mode != b->mode) if (a->mode != b->mode)
return 0; return 0;
if (a->mode != MPOL_DEFAULT && !mpol_match_intent(a, b)) if (a->flags != b->flags)
return 0;
if (mpol_store_user_nodemask(a))
if (!nodes_equal(a->w.user_nodemask, b->w.user_nodemask))
return 0; return 0;
switch (a->mode) { switch (a->mode) {
case MPOL_BIND: case MPOL_BIND:
/* Fall through */ /* Fall through */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册