linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: "Paul E. McKenney" <paulmck@linux.ibm.com>,
	Nikolay Borisov <nborisov@suse.com>,
	linux-kernel@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	Josh Triplett <josh@joshtriplett.org>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	linux-doc@vger.kernel.org,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: Re: [PATCH RFC] doc: rcu: remove obsolete (non-)requirement about disabling preemption
Date: Thu, 18 Oct 2018 20:58:44 -0700	[thread overview]
Message-ID: <20181019035844.GA141835@joelaf.mtv.corp.google.com> (raw)
In-Reply-To: <20181018225223.42641c73@vmware.local.home>

On Thu, Oct 18, 2018 at 10:52:23PM -0400, Steven Rostedt wrote:
> On Thu, 18 Oct 2018 19:25:29 -0700
> Joel Fernandes <joel@joelfernandes.org> wrote:
> 
> > On Thu, Oct 18, 2018 at 09:50:35PM -0400, Steven Rostedt wrote:
> > > On Thu, 18 Oct 2018 18:26:45 -0700
> > > Joel Fernandes <joel@joelfernandes.org> wrote:
> > >   
> > > > Yes, local_irq_restore is light weight, and does not check for reschedules.
> > > > 
> > > > I was thinking of case where ksoftirqd is woken up, but does not run unless
> > > > we set the NEED_RESCHED flag. But that should get set anyway since probably
> > > > ksoftirqd is of high enough priority than the currently running task..
> > > > 
> > > > Roughly speaking the scenario could be something like:
> > > > 
> > > > rcu_read_lock();
> > > >                  <-- IPI comes in for the expedited GP, sets exp_hint
> > > > local_irq_disable();
> > > > // do a bunch of stuff
> > > > rcu_read_unlock();   <-- This calls the rcu_read_unlock_special which raises
> > > >                          the soft irq, and wakesup softirqd.  
> > > 
> > > If softirqd is of higher priority than the current running task, then
> > > the try_to_wake_up() will set NEED_RESCHED of the current task here.
> > >   
> > 
> > Yes, only *if*. On my system, ksoftirqd is CFS nice 0. I thought expedited
> > grace periods are quite important and they should complete quickly which is
> > the whole reason for interrupting rcu read sections with an IPI and stuff.
> > IMO there should be no harm in setting NEED_RESCHED unconditionally anyway
> > for possible benefit of systems where the ksoftirqd is not of higher priority
> > than the currently running task, and we need to run it soon on the CPU. But
> > I'm Ok with whatever Paul and you want to do here.
> 
> 
> Setting NEED_RESCHED unconditionally wont help. Because even if we call
> schedule() ksoftirqd will not be scheduled! If it's CFS nice 0, and the
> current task still has quota to run, if you call schedule, you'll just
> waste time calculating that the current task should still be running.
> It's equivalent to calling yield() (which is why we removed all yield()
> users in the kernel, because *all* of them were buggy!). This is *why*
> it only calls schedule *if* softirqd is of higher priority.

Yes, ok. you are right the TTWU path should handle setting the NEED_RESCHED
flag or not and unconditionally setting it does not get us anything. I had to
go through the code a bit since it has been a while since I explored it.

So Paul, I'm Ok with your latest patch for the issue we discussed and don't
think much more can be done barring raising of ksofitrqd priorities :-) So I
guess the synchronize_rcu_expedited will just cope with the deal between
local_irq_enable and the next scheduling point.. :-)

thanks,

- Joel


  reply	other threads:[~2018-10-19  3:58 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-14 21:29 [PATCH RFC] doc: rcu: remove obsolete (non-)requirement about disabling preemption Joel Fernandes (Google)
2018-10-14 23:17 ` Paul E. McKenney
2018-10-15  2:08   ` Joel Fernandes
2018-10-15  2:13     ` Joel Fernandes
2018-10-15  2:33       ` Paul E. McKenney
2018-10-15  2:47         ` Joel Fernandes
2018-10-15  2:50           ` Joel Fernandes
2018-10-15  6:05           ` Nikolay Borisov
2018-10-15 11:21             ` Paul E. McKenney
2018-10-15 19:39               ` Joel Fernandes
2018-10-15 19:54                 ` Paul E. McKenney
2018-10-15 20:15                   ` Joel Fernandes
2018-10-15 21:08                     ` Paul E. McKenney
2018-10-16 11:26                       ` Paul E. McKenney
2018-10-16 20:41                         ` Joel Fernandes
2018-10-17 16:11                           ` Paul E. McKenney
2018-10-17 18:15                             ` Joel Fernandes
2018-10-17 20:33                               ` Paul E. McKenney
2018-10-18  2:07                                 ` Joel Fernandes
2018-10-18 14:46                                   ` Paul E. McKenney
2018-10-19  0:03                                     ` Joel Fernandes
2018-10-19  0:19                                       ` Paul E. McKenney
2018-10-19  1:12                                         ` Steven Rostedt
2018-10-19  1:27                                           ` Joel Fernandes
2018-10-19  1:26                                         ` Joel Fernandes
2018-10-19  1:50                                           ` Steven Rostedt
2018-10-19  2:25                                             ` Joel Fernandes
2018-10-19  2:52                                               ` Steven Rostedt
2018-10-19  3:58                                                 ` Joel Fernandes [this message]
2018-10-19 12:07                                                   ` Paul E. McKenney
2018-10-19 17:24                                                     ` Joel Fernandes
2018-10-19 18:11                                                       ` Paul E. McKenney

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=20181019035844.GA141835@joelaf.mtv.corp.google.com \
    --to=joel@joelfernandes.org \
    --cc=corbet@lwn.net \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=nborisov@suse.com \
    --cc=paulmck@linux.ibm.com \
    --cc=rostedt@goodmis.org \
    /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;
as well as URLs for NNTP newsgroup(s).