Re: [PATCH v2 7/9] sched: define TIF_ALLOW_RESCHED

From: Steven Rostedt
Date: Mon Sep 11 2023 - 22:23:42 EST


On Mon, 11 Sep 2023 16:10:31 -0700
Ankur Arora <ankur.a.arora@xxxxxxxxxx> wrote:

> An even crazier version of that idea would be to have
> preempt_disable/enable() demarcate regions, and the compiler putting all
> of the preemption disabled region out-of-line to a special section.
> Seems to me, that then we could do away to preempt_enable/disable()?
> (Ignoring the preempt_count used in hardirq etc.)
>

I thought about this too, but wasn't sure if it would be easier or harder
to implement. This would still require the duplicate functions (which I
guess would be the most difficult part).

> This would allow preemption always, unless executing in the
> preemption-disabled section.
>
> Though I don't have any intuition for how much extra call overhead this
> would add.

I don't think this version would have as high of an overhead. You would get
a direct jump (which isn't bad as all speculation knows exactly where to
look), and it would improve the look up. No table, just a simple range
check.

-- Steve