mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 01:21:58 +00:00
[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>
This commit is contained in:
parent
1f09f9749c
commit
aa1757f90b
4 changed files with 13 additions and 21 deletions
|
@ -330,7 +330,7 @@ void __exit_sighand(struct task_struct *tsk)
|
|||
/* Ok, we're done with the signal handlers */
|
||||
tsk->sighand = NULL;
|
||||
if (atomic_dec_and_test(&sighand->count))
|
||||
sighand_free(sighand);
|
||||
kmem_cache_free(sighand_cachep, sighand);
|
||||
}
|
||||
|
||||
void exit_sighand(struct task_struct *tsk)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue