diff options
| author | Oleg Nesterov <[email protected]> | 2010-05-26 21:43:16 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2010-05-27 16:12:46 +0000 |
| commit | ea6d290ca34c4fd91b7348338c0cc7bdeff94a35 (patch) | |
| tree | 6e9bd367650d9233c5b6cf1059845f17cb1bc460 /fs/proc/array.c | |
| parent | fork/exit: move tty_kref_put() outside of __cleanup_signal() (diff) | |
| download | kernel-ea6d290ca34c4fd91b7348338c0cc7bdeff94a35.tar.gz kernel-ea6d290ca34c4fd91b7348338c0cc7bdeff94a35.zip | |
signals: make task_struct->signal immutable/refcountable
We have a lot of problems with accessing task_struct->signal, it can
"disappear" at any moment. Even current can't use its ->signal safely
after exit_notify(). ->siglock helps, but it is not convenient, not
always possible, and sometimes it makes sense to use task->signal even
after this task has already dead.
This patch adds the reference counter, sigcnt, into signal_struct. This
reference is owned by task_struct and it is dropped in
__put_task_struct(). Perhaps it makes sense to export
get/put_signal_struct() later, but currently I don't see the immediate
reason.
Rename __cleanup_signal() to free_signal_struct() and unexport it. With
the previous changes it does nothing except kmem_cache_free().
Change __exit_signal() to not clear/free ->signal, it will be freed when
the last reference to any thread in the thread group goes away.
Note:
- when the last thead exits signal->tty can point to nowhere, see
the next patch.
- with or without this patch signal_struct->count should go away,
or at least it should be "int nr_threads" for fs/proc. This will
be addressed later.
Signed-off-by: Oleg Nesterov <[email protected]>
Cc: Alan Cox <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Acked-by: Roland McGrath <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'fs/proc/array.c')
0 files changed, 0 insertions, 0 deletions
