Re: [RFC PATCH 3/3] sched/Documentation: Point out use of preempt_schedule_irq()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/02/2019 08:45, Julien Thierry wrote:
[...]
>> +Kernel preemption
>> +=================
>> +When returning from interrupt context, you should call either of
>> +preempt_schedule() or preempt_schedule_irq() if preemption is enabled
>> +and need_resched() is true.
>> +
> 
> I don't think preempt_schedule() is really an option for a return from
> interrupt. First thing preempt_schedule() does is:
> 
>         if (likely(!preemptible()))
> 		return;
> 
> And preemptible() is:
> 
> preempt_count() == 0 && !irqs_disabled()
> 
> Generally on return from interrupt context interrupts are disabled, so
> we would never be preemptible() and preempt_schedule() would just do
> nothing.
> 
> Unless I'm missing something.
> 

No, I think you're right. The main reason I still mentioned it here is to
be conservative, although I must admit I've started confusing what we
have vs what we used to have since my dive into the history.

If I look at some archs that don't use preempt_schedule_irq() (e.g. alpha,
unicore32), they seem to be calling schedule() directly - but I don't see
any (*current*) user of preempt_schedule() on interrupt return.

preempt_schedule() still has this comment attached to it:

 * this is the entry point to schedule() from in-kernel preemption
 * off of preempt_enable. Kernel preemptions off return from interrupt
 * occur there and call schedule directly.

So I might just remove the mention to preempt_schedule() in the doc and
also change the comment.

Thanks,
Valentin



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux