diff options
author | Andrea Arcangeli <andrea@novell.com> | 2005-01-03 04:15:21 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-01-03 04:15:21 -0800 |
commit | 182e0eba1fd730e32522d91d2d913712d202d3d2 (patch) | |
tree | d6c5577a898e0d42d2ec5181ba3abc2e99892789 /mm | |
parent | 250c01d06ccb125519cc9958d938f41736868be9 (diff) | |
download | history-182e0eba1fd730e32522d91d2d913712d202d3d2.tar.gz |
[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: Andrea Arcangeli <andrea@novell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mempolicy.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 710dfa9bf86d46..1c8cbaf596a5a7 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1028,12 +1028,10 @@ restart: 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 */ |