public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Jörn Engel" <joern@purestorage.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>
Subject: Re: sched: wakeup setting TIF_NEED_RESCHED too frequently
Date: Wed, 28 Apr 2021 10:30:05 +0200	[thread overview]
Message-ID: <YIkdDeb9c+XmDRvM@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YIh/QubidJcE5IIv@cork>

On Tue, Apr 27, 2021 at 02:16:50PM -0700, Jörn Engel wrote:
> Anyway, trying to find a cause, I noticed the following call chain:
> 	set_nr_if_polling()
> 	ttwu_queue_remote()
> 	ttwu_queue()
> 	try_to_wake_up()
> 	default_wake_function()
> 	curr->func()
> 	__wake_up_common()
> 	__wake_up_common_lock()
> 	__wake_up()
> 	wake_up()
> 
> Call chain above is manually created from source code.  Closest sample I
> caught with instrumentation is missing the leaf calls after
> try_to_wake_up():
> 	_raw_spin_unlock_irqrestore+0x1f/0x40
> 	try_to_wake_up+0x425/0x5e0
> 	wake_up_q+0x3f/0x80
> 	futex_wake+0x159/0x180
> 	do_futex+0xcd/0xba0
> 
> Afaics, the result is us setting TIF_NEED_RESCHED on any wakeup, unless
> wake_list is already populated.  Is that actually intentional?  And is
> that useful for performance of latency?  I think it isn't, but I am
> probably missing something here.

set_nr_if_polling() only sets TIF_NEED_RESCHED IFF TIF_POLLING_NRFLAG is
set. TIF_POLLING_NRFLAG is only set when idle and is then sufficient to
wake that cpu and reschedule.

If not TIF_POLLING_NRFLAG, then we send an IPI to deal with the
non-empty wake_list.

  reply	other threads:[~2021-04-28  8:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-27 21:16 sched: wakeup setting TIF_NEED_RESCHED too frequently Jörn Engel
2021-04-28  8:30 ` Peter Zijlstra [this message]
2021-04-28 18:51   ` Jörn Engel

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=YIkdDeb9c+XmDRvM@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=joern@purestorage.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@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