lkml.org 
[lkml]   [2014]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Do we really need curr_target in signal_struct ?
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.



\
 
 \ /
  Last update: 2014-01-28 18:21    [W:0.074 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site