diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2006-03-28 19:11:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-28 21:36:42 -0500 |
commit | aa1757f90bea3f598b6e5d04d922a6a60200f1da (patch) | |
tree | 4f8f3804b2595031d0b84de7086dc28375290f0d /fs/exec.c | |
parent | 1f09f9749cdde4e69f95d62d96d2e03f50b3353c (diff) |
[PATCH] convert sighand_cache to use SLAB_DESTROY_BY_RCU
This patch borrows a clever Hugh's 'struct anon_vma' trick.
Without tasklist_lock held we can't trust task->sighand until we locked it
and re-checked that it is still the same.
But this means we don't need to defer 'kmem_cache_free(sighand)'. We can
return the memory to slab immediately, all we need is to be sure that
sighand->siglock can't dissapear inside rcu protected section.
To do so we need to initialize ->siglock inside ctor function,
SLAB_DESTROY_BY_RCU does the rest.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -768,7 +768,6 @@ no_thread_group: | |||
768 | /* | 768 | /* |
769 | * Move our state over to newsighand and switch it in. | 769 | * Move our state over to newsighand and switch it in. |
770 | */ | 770 | */ |
771 | spin_lock_init(&newsighand->siglock); | ||
772 | atomic_set(&newsighand->count, 1); | 771 | atomic_set(&newsighand->count, 1); |
773 | memcpy(newsighand->action, oldsighand->action, | 772 | memcpy(newsighand->action, oldsighand->action, |
774 | sizeof(newsighand->action)); | 773 | sizeof(newsighand->action)); |
@@ -785,7 +784,7 @@ no_thread_group: | |||
785 | write_unlock_irq(&tasklist_lock); | 784 | write_unlock_irq(&tasklist_lock); |
786 | 785 | ||
787 | if (atomic_dec_and_test(&oldsighand->count)) | 786 | if (atomic_dec_and_test(&oldsighand->count)) |
788 | sighand_free(oldsighand); | 787 | kmem_cache_free(sighand_cachep, oldsighand); |
789 | } | 788 | } |
790 | 789 | ||
791 | BUG_ON(!thread_group_leader(current)); | 790 | BUG_ON(!thread_group_leader(current)); |