From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>, Roland McGrath <roland@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [RFC,PATCH 2/2] __group_complete_signal: fix? signal load-balancing
Date: Thu, 6 Mar 2008 01:43:21 +0300 [thread overview]
Message-ID: <20080305224321.GA6345@tv-sign.ru> (raw)
The patch needs an ack, probably I just misunderstood the comments.
Suppose that the main thread blocks the signal. In that case
__group_complete_signal() tries to find another thread starting from
signal->curr_target.
The comment says about load-balancing, but this is not what happens?
Suppose that wants_signal(signal->curr_target) == T. In that case we
always choose the same ->curr_target thread. Isn't it better to try
to "spread" the signals over the thread group?
With this patch we are trying to find another suitable thread starting
from next_thread(signal->curr_target), thus distributing the load over
the whole thread group.
Bad idea? If not, probably we can also remove the "if (wants_signal())"
at the top of __group_complete_signal() ?
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 25/kernel/signal.c~4_GCS_BALANCE 2008-03-06 01:07:55.000000000 +0300
+++ 25/kernel/signal.c 2008-03-06 01:34:57.000000000 +0300
@@ -863,13 +863,14 @@ __group_complete_signal(int sig, struct
/*
* Otherwise try to find a suitable thread.
*/
- t = signal->curr_target;
- if (t == NULL)
- /* restart balancing at this thread */
- t = signal->curr_target = p;
+ if (!signal->curr_target)
+ signal->curr_target = p;
- while (!wants_signal(sig, t)) {
+ for (t = signal->curr_target ;; ) {
t = next_thread(t);
+ if (wants_signal(sig, t))
+ break;
+
if (t == signal->curr_target)
/*
* No thread needs to be woken.
next reply other threads:[~2008-03-05 22:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-05 22:43 Oleg Nesterov [this message]
2008-03-06 11:57 ` Roland McGrath
2008-03-07 3:13 ` 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=20080305224321.GA6345@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=roland@redhat.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
all inboxes | Powered by JetHome®