[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181112022455.GD4170@linux.ibm.com>
Date: Sun, 11 Nov 2018 18:24:55 -0800
From: "Paul E. McKenney" <paulmck@...ux.ibm.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, mingo@...nel.org,
jiangshanlai@...il.com, dipankar@...ibm.com,
akpm@...ux-foundation.org, mathieu.desnoyers@...icios.com,
josh@...htriplett.org, tglx@...utronix.de, rostedt@...dmis.org,
dhowells@...hat.com, edumazet@...gle.com, fweisbec@...il.com,
oleg@...hat.com, joel@...lfernandes.org,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH tip/core/rcu 23/41] sched: Replace synchronize_sched()
with synchronize_rcu()
On Mon, Nov 12, 2018 at 03:07:10AM +0100, Peter Zijlstra wrote:
> On Sun, Nov 11, 2018 at 05:47:36PM -0800, Paul E. McKenney wrote:
> > On Mon, Nov 12, 2018 at 01:53:29AM +0100, Peter Zijlstra wrote:
> > > On Sun, Nov 11, 2018 at 04:45:28PM -0800, Paul E. McKenney wrote:
> > > > On Mon, Nov 12, 2018 at 01:12:33AM +0100, Peter Zijlstra wrote:
> > > > > On Sun, Nov 11, 2018 at 11:43:52AM -0800, Paul E. McKenney wrote:
> > > > > > Now that synchronize_rcu() waits for preempt-disable regions of code
> > > > > > as well as RCU read-side critical sections, synchronize_sched() can be
> > > > > > replaced by synchronize_rcu(). This commit therefore makes this change.
> > > > >
> > > > > Yes, but it also waits for an actual RCU quiestent state, which makes
> > > > > synchoinize_rcu() potentially much more expensive than an actual
> > > > > synchronize_sched().
> > > >
> > > > None of the readers have changed.
> > > >
> > > > For the updaters, if CONFIG_PREEMPT=n, synchronize_rcu() and
> > > > synchronize_sched() always were one and the same. When CONFIG_PREEMPT=y,
> > > > synchronize_rcu() and synchronize_sched() are now one and the same.
> > >
> > > The Changelog does not state this; and does the commit that makes that
> > > happen state the regression potential?
> >
> > The Changelog says this:
> >
> > Now that synchronize_rcu() waits for preempt-disable
> > regions of code as well as RCU read-side critical sections,
> > synchronize_sched() can be replaced by synchronize_rcu().
> > This commit therefore makes this change.
> >
> > The "synchronize_rcu() waits for preempt-disable regions of code as
> > well as RCU read-side critical sections" seems pretty unambiguous to me.
> > Exactly what more are you wanting said there?
>
> The quoted bit only states that synchronize_rcu() is sufficient; it does
> not say it is equivalent and the patch is a nop. It also doesn't say
> that the purpose is to get rid of the synchronize_sched() function.
>
> > There were quite a few commits involved in making this happen. Perhaps
> > the most pertinent are these:
> >
> > 3e3100989869 ("rcu: Defer reporting RCU-preempt quiescent states when disabled")
> > 45975c7d21a1 ("rcu: Define RCU-sched API in terms of RCU for Tree RCU PREEMPT builds")
>
> The latter; it does not mention that this will possible make
> synchronize_sched() quite a bit more expensive on PREEMPT=y builds :/
In theory, sure. In practice, people have switched any number of
things from RCU-sched to RCU and back without problems.
> > Normal grace periods are almost always quite long compared to typical
> > read-side critical sections, preempt-disable regions of code, and so on.
> > So in the common case this should be OK. Or are you instead worried
> > about synchronize_sched_expedited()?
>
> No, I still feel expedited should not exist at all ;-)
I figured as much. ;-)
> But for PREEMPT=y synchronize_sched() can be quite a bit shorter than
> synchronize_rcu(), since we don't have to wait for preempted read side
> stuff.
Again, there are quite a few places that have managed that transition
without issue. Why do you expect this change to have problems that have
not been seen elsewhere?
> > > > > So why are we doing this?
> > > >
> > > > Given that synchronize_rcu() and synchronize_sched() are now always one
> > > > and the same, this is a distinction without a difference.
> > >
> > > The Changelog did not state a reason for the patch. Therefore it is a
> > > bad patch.
> >
> > ??? Here is the current definition of synchronize_sched() in mainline:
> >
> > static inline void synchronize_sched(void)
> > {
> > synchronize_rcu();
> > }
>
> Again, the patch didn't say that.
>
> If the Changelog would've read something like:
>
> "Since synchronize_sched() is now equivalent to synchronize_rcu(),
> replace the synchronize_sched() usage such that we can eventually remove
> the interface."
>
> It would've been clear that the patch is a nop and what the purpose
> was.
I can easily make that change.
Thanx, Paul
Powered by blists - more mailing lists