mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC,PATCH 2/2] __group_complete_signal: fix? signal load-balancing
Date: Fri, 7 Mar 2008 06:13:24 +0300	[thread overview]
Message-ID: <20080307031324.GA214@tv-sign.ru> (raw)
In-Reply-To: <20080306115710.186322700FD@magilla.localdomain>

On 03/06, Roland McGrath wrote:
>
> > 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?
>
> The "load balancing" stuff was in the old multithreaded signals code (2.5)
> from before I rearranged a lot of code to fix the main parts of the MT
> semantics.  Maybe it was Ingo who originally put that code in?  I moved
> everything around it to change the deterministic semantics, but I never
> really gave any thought to the "performance feature".  Perhaps it did
> something different to begin with and bit-rot made it into the algorithm we
> have that seems not so optimal .
>
> The current behavior hammers all the unblocked signals onto one thread
> until it's scheduled out.  For getting the signal delivered as quickly as
> can be, it makes some sense to choose running threads (task_curr) over
> threads blocked without signals already pending.  So perhaps the same
> thread that just ran a signal handler (maybe is still setting it up) really
> is the preferable choice when it's on the CPU--at least in comparison to
> another candidate thread that is not on a CPU.  But it's not exactly doing
> "load balancing".  If several threads are running on CPUs, presumably it's
> intended to spread several near-simultaneous signals across those CPUs.
>
> Perhaps Ingo has some thoughts on what the original plan is, or on what
> desireable performance choices are now.

OK, thanks, please ignore this patch (it was more the question anyway).

So. currently the meaning of->curr_target is: remember the last thread
we sent a signal, may help to avoid iterating over the thread group when
the next signal is sent.

> If we're cleaning up, we can start by getting rid of the NULL check.
> There's no reason to have it in this hot path.  It should never come
> up if we make copy_signal initialize sig->curr_target = tsk.

Can't understand why I didn't realize this while reading the code.
Looks like a reasonable cleanup regardless.

Oleg.


      reply	other threads:[~2008-03-07  3:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05 22:43 Oleg Nesterov
2008-03-06 11:57 ` Roland McGrath
2008-03-07  3:13   ` Oleg Nesterov [this message]

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=20080307031324.GA214@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®