Skip to content

Commit

Permalink
mempolicy: remove redundant check
Browse files Browse the repository at this point in the history
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: Bob Liu <lliubbo@gmail.com>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Bob Liu authored and Linus Torvalds committed May 25, 2010
1 parent 6eb27e1 commit 1980050
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1787,25 +1787,19 @@ struct mempolicy *__mpol_cond_copy(struct mempolicy *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 */
int __mpol_equal(struct mempolicy *a, struct mempolicy *b)
{
if (!a || !b)
return 0;
if (a->mode != b->mode)
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;

switch (a->mode) {
case MPOL_BIND:
/* Fall through */
Expand Down

0 comments on commit 1980050

Please sign in to comment.