Re: [PATCH 26/30] sched: handle preempt=voluntary under PREEMPT_AUTO

From: Linus Torvalds
Date: Mon Mar 11 2024 - 16:23:46 EST


On Mon, 11 Mar 2024 at 13:10, Ankur Arora <ankur.a.arora@xxxxxxxxxx> wrote:
>
> Ah, I see your point. Basically, keep the lazy semantics but -- in
> addition -- also provide the ability to dynamically toggle
> cond_resched(), might_reshed() as a feature to help move this along
> further.

Please, let's not make up any random hypotheticals.

Honestly, if we ever hit the hypothetical scenario that Paul outlined, let's

(a) deal with it THEN, when we actually know what the situation is

(b) learn and document what it is that actually causes the odd behavior

IOW, instead of assuming that some "cond_resched()" case would even be
the right thing to do, maybe there are other issues going on? Let's
not paper over them by keeping some hack around - and *if* some
cond_resched() model is actually the right model in some individual
place, let's make it the rule that *when* we hit that case, we
document it.

And we should absolutely not have some hypothetical case keep us from
just doing the right thing and getting rid of the existing
cond_resched().

Because any potential future case is *not* going to be the same
cond_resched() that the current case is anyway. It is going to have
some very different cause.

Linus