Re: [PATCH 2/7] rcu: limit PREEMPT_RCU configurations
From: Paul E. McKenney
Date: Thu Oct 10 2024 - 10:37:07 EST
On Thu, Oct 10, 2024 at 12:44:38PM +0200, Peter Zijlstra wrote:
> On Thu, Oct 10, 2024 at 12:26:57PM +0200, Sebastian Andrzej Siewior wrote:
> > On 2024-10-10 12:03:08 [+0200], Peter Zijlstra wrote:
> > > >
> > > > I can't deselect CONFIG_PREEMPT_RCU=y. This is because LAZY selects
> > > > PREEMPT_BUILD and PREEMPT_RCU selects itself once PREEMPTION is on.
That is not good!
> > > Oh, the entry isn't user selectable? Fix that perhaps?
> > >
> > > - bool
> > > + bool "Use preemptible RCU"
> > >
> > > Or something along those lines -- I forever forget how Kconfig works.
> >
> > Oh. Well, yes. If we do this then it becomes suddenly selectable and
> > half of the series makes sense…
> > But as you said, this complicates things.
>
> But then you leave it up to the user, instead of doing something quite
> random. This would allow you to configure PREEMPT_RCU=n despite also
> using PREEMPT_DYNAMIC if that is your thing.
Ahem. How many users keep track of all of the Kconfig options? I doubt
that this number is greater than zero. Part of the goal here needs to
be to minimize the Kconfig futzing users must do. The default settings
really do matter.
> I fundamentally hate the whole randomness of the earlier proposed
> selection criteria. It only disables PREEMPT_RCU if you use LAZY and not
> also have PREEMPT_RT or PREEMPT_DYNAMIC.
Not at all random.
If you have PREEMPT_RT, you need preemptible RCU, so the defaults should
supply it.
If you have PREEMPT_DYNAMIC, presumably you would like to boot with
preemption enabled, and would like it to act as if you had built the
kernel to be unconditionally preemptible, so again you need preemptible
RCU, and so the defaults should supply it.
If you started off building a non-preemptible kernel, then you are not
using one of the major distros (last I checked). There is a good chance
that you have a large number of systems, and are thus deeply interested
in minimizing memory cost. In which case, you need non-preemptible
RCU in the new-age lazy-preemptible kernel.
Hence the choice of non-preemptible RCU as the default in a kernel that,
without lazy preemption, would use non-preemptible RCU.
Thanx, Paul