Commit 182e0eba authored by Andrea Arcangeli's avatar Andrea Arcangeli Committed by Linus Torvalds

[PATCH] mempolicy optimisation

Some optimizations in mempolicy.c (like to avoid rebalancing the tree while
destroying it and by breaking loops early and not checking for invariant
conditions in the replace operation).
Signed-off-by: default avatarAndrea Arcangeli <andrea@novell.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 250c01d0
......@@ -1028,12 +1028,10 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start,
return -ENOMEM;
goto restart;
}
n->end = end;
n->end = start;
sp_insert(sp, new2);
new2 = NULL;
}
/* Old crossing beginning, but not end (easy) */
if (n->start < start && n->end > start)
break;
} else
n->end = start;
}
if (!next)
......@@ -1086,11 +1084,11 @@ void mpol_free_shared_policy(struct shared_policy *p)
while (next) {
n = rb_entry(next, struct sp_node, nd);
next = rb_next(&n->nd);
rb_erase(&n->nd, &p->root);
mpol_free(n->policy);
kmem_cache_free(sn_cache, n);
}
spin_unlock(&p->lock);
p->root = RB_ROOT;
}
/* assumes fs == KERNEL_DS */
......
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