Re: [RFC PATCH 00/86] Make the kernel preemptible

From: Steven Rostedt
Date: Wed Nov 08 2023 - 11:22:31 EST


On Wed, 08 Nov 2023 16:38:11 +0100
Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:

> On Wed, Nov 08 2023 at 11:13, Peter Zijlstra wrote:
> > On Wed, Nov 08, 2023 at 02:04:02AM -0800, Ankur Arora wrote:
> > I'm not understanding, those should stay obviously.
> >
> > The current preempt_dynamic stuff has 5 toggles:
> >
> > /*
> > * SC:cond_resched
> > * SC:might_resched
> > * SC:preempt_schedule
> > * SC:preempt_schedule_notrace
> > * SC:irqentry_exit_cond_resched
> > *
> > *
> > * NONE:
> > * cond_resched <- __cond_resched
> > * might_resched <- RET0
> > * preempt_schedule <- NOP
> > * preempt_schedule_notrace <- NOP
> > * irqentry_exit_cond_resched <- NOP
> > *
> > * VOLUNTARY:
> > * cond_resched <- __cond_resched
> > * might_resched <- __cond_resched
> > * preempt_schedule <- NOP
> > * preempt_schedule_notrace <- NOP
> > * irqentry_exit_cond_resched <- NOP
> > *
> > * FULL:
> > * cond_resched <- RET0
> > * might_resched <- RET0
> > * preempt_schedule <- preempt_schedule
> > * preempt_schedule_notrace <- preempt_schedule_notrace
> > * irqentry_exit_cond_resched <- irqentry_exit_cond_resched
> > */
> >
> > If you kill voluntary as we know it today, you can remove cond_resched
> > and might_resched, but the remaining 3 are still needed to switch
> > between NONE and FULL.
>
> No. The whole point of LAZY is to keep preempt_schedule(),
> preempt_schedule_notrace(), irqentry_exit_cond_resched() always enabled.

Right.

* NONE:
* cond_resched <- __cond_resched
* might_resched <- RET0
* preempt_schedule <- NOP
* preempt_schedule_notrace <- NOP
* irqentry_exit_cond_resched <- NOP

Peter, how can you say we can get rid of cond_resched() in NONE when you
show that NONE still uses it? I thought the entire point of this was to get
rid of all the cond_resched() and they are there for PREEMPT_NONE as well as
VOLUNTARY. As you showed above, the only difference between NONE and
VOLUNTARY was the might_sleep.

>
> Look at my PoC: https://lore.kernel.org/lkml/87jzshhexi.ffs@tglx/

And I've been saying that many times already ;-)

Thanks Thomas for reiterating it.

-- Steve