On 01/28, Rakib Mullick wrote:
>
> As an alternative of using curr_target we can use get_nr_thread() count

We do not even need get_nr_thread() if we want to kill curr_target,

> @@ -961,21 +962,16 @@ static void complete_signal(int sig, struct task_struct 
> *p, int group)
>                */
>               return;
>       else {
> -             /*
> -              * Otherwise try to find a suitable thread.
> -              */
> -             t = signal->curr_target;
> -             while (!wants_signal(sig, t)) {
> +             i = get_nr_threads(p);
> +             t = p;
> +             do {
> +                     --i;
>                       t = next_thread(t);
> -                     if (t == signal->curr_target)
> -                             /*
> -                              * No thread needs to be woken.
> -                              * Any eligible threads will see
> -                              * the signal in the queue soon.
> -                              */
> +                     if (!i)
>                               return;
> -             }
> -             signal->curr_target = t;
> +             } while (!wants_signal(sig, t));

You could simply do while_each_thread(p, t) to find a thread which
wants_signal(..).

But I guess ->curr_target was added exactly to avoid this loop if
possible, assuming that wants_signal(->current_targer) should be
likely true. Although perhaps this optimization is too simple.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to