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

Peter Zijlstra
2023-09-09T09:11:31Z

On Fri, Sep 08, 2023 at 11:39:47PM -0700, Ankur Arora wrote:

> Yeah, exactly. Though, not even a single context level, but a flag
> attached to a single context at the process level only. Using
> preempt_count() == 0 as the preemption boundary.
>
> However, this has a problem with the PREEMPT_COUNT=n case because that
> doesn't have a preemption boundary.

So, with a little sleep, the nested exception/interrupt case should be
good, irqenrty_enter() / irqentry_nmi_enter() unconditionally increment
preempt_count with HARDIRQ_OFFSET / NMI_OFFSET.

So while regular preempt_{dis,en}able() will turn into a NOP, the entry
code *will* continue to increment preempt_count.