lkml.org 
[lkml]   [2023]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 7/9] sched: define TIF_ALLOW_RESCHED
On Fri, Sep 08, 2023 at 10:30:57PM -0700, Ankur Arora wrote:

> > which actually makes me worry about the nested irq case, because this
> > would *not* be ok:
> >
> > allow_resched();
> > -> irq happens
> > -> *nested* irq happens
> > <- nested irq return (andapreemption)
> >
> > ie the allow_resched() needs to still honor the irq count, and a
> > nested irq return obviously must not cause any preemption.
>
> IIUC, this should be equivalent to:
>
> 01 allow_resched();
> 02 -> irq happens
> 03 preempt_count_add(HARDIRQ_OFFSET);
> 04 -> nested irq happens
> 05 preempt_count_add(HARDIRQ_OFFSET);
> 06
> 07 preempt_count_sub(HARDIRQ_OFFSET);
> 08 <- nested irq return
> 09 preempt_count_sub(HARDIRQ_OFFSET);
>
> So, even if there were nested interrrupts, then the !preempt_count()
> check in raw_irqentry_exit_cond_resched() should ensure that no
> preemption happens until after line 09.

Yes, this.

\
 
 \ /
  Last update: 2023-09-09 11:13    [W:0.107 / U:26.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site