Re: [PATCH 2/7] rcu: limit PREEMPT_RCU configurations
From: Paul E. McKenney
Date: Wed Oct 09 2024 - 14:24:20 EST
On Wed, Oct 09, 2024 at 08:01:17PM +0200, Peter Zijlstra wrote:
> On Wed, Oct 09, 2024 at 09:54:06AM -0700, Ankur Arora wrote:
> > PREEMPT_LAZY can be enabled stand-alone or alongside PREEMPT_DYNAMIC
> > which allows for dynamic switching of preemption models.
> >
> > The choice of preemptible RCU or not, however, is fixed at compile
> > time. Given the trade-offs made to have a preemptible RCU, some
> > configurations which have limited preemption might prefer the
> > stronger forward-progress guarantees of PREEMPT_RCU=n.
> >
> > Accordingly, explicitly limit PREEMPT_RCU=y to PREEMPT_DYNAMIC,
> > PREEMPT, PREEMPT_RT.
> >
> > This means that (PREEMPT_LAZY=y, PREEMPT_DYNAMIC=n), which selects
> > PREEMPTION will run with PREEMPT_RCU=n. The combination (PREEMPT_LAZY=y,
> > PREEMPT_DYNAMIC=y), will run with PREEMPT_RCU=y.
>
> I am completely confused by this. Why do we want this?
In order to support systems that currently run CONFIG_PREEMPT=n that
are adequately but not overly endowed with memory. If we allow all
RCU readers to be preempted, we increase grace-period latency, and also
increase OOM incidence. Which we would like to avoid.
But we do want lazy preemption otherwise, for but one thing to reduce
tail latencies and to reduce the need for preemption points. Thus, we
want a way to allow lazy preemption in general, but to continue with
non-preemptible RCU read-side critical sections.
Or am I once again missing your point?
Thanx, Paul
> > Cc: Paul E. McKenney <paulmck@xxxxxxxxxx>
> > Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> > Signed-off-by: Ankur Arora <ankur.a.arora@xxxxxxxxxx>
> > ---
> > kernel/rcu/Kconfig | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
> > index 3e079de0f5b4..1bfe7016724f 100644
> > --- a/kernel/rcu/Kconfig
> > +++ b/kernel/rcu/Kconfig
> > @@ -18,7 +18,7 @@ config TREE_RCU
> >
> > config PREEMPT_RCU
> > bool
> > - default y if PREEMPTION
> > + default y if (PREEMPT || PREEMPT_RT || PREEMPT_DYNAMIC)
> > select TREE_RCU
> > help
> > This option selects the RCU implementation that is
> > --
> > 2.43.5
> >