From: Oleg Nesterov <oleg@redhat.com>
To: Rakib Mullick <rakib.mullick@gmail.com>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: Do we really need curr_target in signal_struct ?
Date: Tue, 28 Jan 2014 17:43:20 +0100 [thread overview]
Message-ID: <20140128164320.GB7596@redhat.com> (raw)
In-Reply-To: <1390895840.8373.2.camel@beeld>
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.
next prev parent reply other threads:[~2014-01-28 16:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-28 7:57 Do we really need curr_target in signal_struct ? Rakib Mullick
2014-01-28 16:43 ` Oleg Nesterov [this message]
2014-01-29 4:09 ` Rakib Mullick
2014-01-29 4:45 ` Rakib Mullick
2014-01-29 14:55 ` Oleg Nesterov
2014-01-29 16:07 ` Rakib Mullick
2014-01-29 18:32 ` Oleg Nesterov
2014-01-30 7:02 ` Rakib Mullick
2014-01-31 18:53 ` Rakib Mullick
2014-02-01 16:51 ` Oleg Nesterov
2014-02-02 16:50 ` Rakib Mullick
2014-02-03 16:39 ` Oleg Nesterov
2014-02-04 4:32 ` Rakib Mullick
2014-02-04 17:34 ` Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140128164320.GB7596@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=rakib.mullick@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox