[lkml]   [2005]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC,PATCH] Use RCU to protect tasklist for unicast signals
(Replying to wrong message, sorry).

Thomas Gleixner wrote:
> --- linux-2.6.13-rc6-rt8/kernel/fork.c 2005-08-17 12:57:08.000000000 +0200
> +++ linux-2.6.13-rc6-rt/kernel/fork.c 2005-08-17 11:17:46.000000000 +0200
> @@ -1198,7 +1198,8 @@ bad_fork_cleanup_mm:
> bad_fork_cleanup_signal:
> exit_signal(p);
> bad_fork_cleanup_sighand:
> - exit_sighand(p);
> + if (p->sighand) /* exit_signal() could have freed p->sighand */
> + exit_sighand(p);

Looks like now it is the only user of exit_signal(), and I think
we can kill this function and just do:


if (p->sighand) {
// p->sighand can't change here, we don't need tasklist lock
if (atomic_dec_and_test(p->sighand->count))
// If we get here we are not sharing ->sighand with anybody else.
// It means, in particular, that p had no CLONE_THREAD flag.
// Nobody can see this process yet, we didn't call attach_pid(),
// otherwise ->sighand was freed from __exit_signal. Thus nobody
// can see this sighand.
It is not an optimization, this path is rare, just to make things
more clear and to reduce "false positives" from grep tasklist_lock.

And I think it makes sense to

#define put_sighand(sig) \
do if atomic_dec_and_test(sig->count) sighand_free(sig); while (0)
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-08-18 14:17    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site