Re: [PATCH tip/core/rcu 23/41] sched: Replace synchronize_sched() with synchronize_rcu()

From: Peter Zijlstra
Date: Mon Nov 12 2018 - 13:18:06 EST


On Mon, Nov 12, 2018 at 05:28:52AM -0800, Paul E. McKenney wrote:
> On Mon, Nov 12, 2018 at 10:00:47AM +0100, Peter Zijlstra wrote:

> > Still, better safe than sorry. It was a rather big change in behaviour,
> > so it wouldn't have been strange to call that out.
>
> This guy:
>
> 45975c7d21a1 ("rcu: Define RCU-sched API in terms of RCU for Tree RCU PREEMPT builds")
>
> Has a commit log that says:
>
> Now that RCU-preempt knows about preemption disabling, its
> implementation of synchronize_rcu() works for synchronize_sched(),
> and likewise for the other RCU-sched update-side API members.
> This commit therefore confines the RCU-sched update-side code
> to CONFIG_PREEMPT=n builds, and defines RCU-sched's update-side
> API members in terms of those of RCU-preempt.
>
> That last phrase seems pretty explicit. What am I missing here?

That does not explicitly state that because RCU-preempt
synchornize_rcu() can take _much_ longer, the new synchronize_sched()
can now take _much_ longer too.

So when someone bisects a problem to this commit; and he reads the
Changelog, he might get the impression that was unexpected.

> Not that it matters, given that I know of no way to change a mainlined
> commit log. I suppose I could ask Jon if he would be willing to take
> a 2018 RCU API LWN article, if that would help.

Yes, it is water under the bridge; but Changelogs should be explicit
about behavioural changes.

And while the merged RCU has the semantic behaviour required, the timing
behaviour did change significantly.

> > > > 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.
> >
> > Please, sufficient doesn't imply necessary etc.. A changelog should
> > always clarify why we do the patch.
>
> ??? Did you mean to say "necessary doesn't imply sufficient"? If so,
> what else do you feel is missing?

No, I meant to say that your original Changelog only states that
sync_rcu now covers rcu-sched behaviour. Which means that the change is
sufficient.

It completely and utterly fails to explain _why_ you're doing the
change. Ie. you do not address why it is necessary.

A Changelog should always explain why the change is needed.

In this case because you want to get rid of the sync_sched() api.