diff options
author | Andi Kleen <ak@muc.de> | 2005-07-27 14:43:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-27 19:25:52 -0400 |
commit | 90c5029e471636f21221bf66b9a46ada2ab79a22 (patch) | |
tree | b3a658d77b16fcecdc3c18bfe6eef679e203b757 | |
parent | c223695634fb360ed65e5a811161853a05e46962 (diff) |
[PATCH] Undo mempolicy shared policy rbtree microoptimization
All mempolicy changes must be inside the spinlock and readding the rb_erase
prevents a crash while doing:
> echo "1" > /tmp/numatest
> numactl --length=0x4000 --shm /tmp/numatest --localalloc
> numactl --length=0x2000 --offset=0 --shm /tmp/numatest --membind=0
> numactl --length=0x2000 --offset=0x2000 --shm /tmp/numatest --membind=1
> ipcs
> ipcrm -M "the_key_value_of_this_shm_area"
Based on a patch by John Blackwood
Cc: <john.blackwood@ccur.com>
Cc: <andrea@suse.de>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | mm/mempolicy.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index cb41c31e7c87..1694845526be 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -1138,11 +1138,11 @@ void mpol_free_shared_policy(struct shared_policy *p) | |||
1138 | while (next) { | 1138 | while (next) { |
1139 | n = rb_entry(next, struct sp_node, nd); | 1139 | n = rb_entry(next, struct sp_node, nd); |
1140 | next = rb_next(&n->nd); | 1140 | next = rb_next(&n->nd); |
1141 | rb_erase(&n->nd, &p->root); | ||
1141 | mpol_free(n->policy); | 1142 | mpol_free(n->policy); |
1142 | kmem_cache_free(sn_cache, n); | 1143 | kmem_cache_free(sn_cache, n); |
1143 | } | 1144 | } |
1144 | spin_unlock(&p->lock); | 1145 | spin_unlock(&p->lock); |
1145 | p->root = RB_ROOT; | ||
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | /* assumes fs == KERNEL_DS */ | 1148 | /* assumes fs == KERNEL_DS */ |