Check for preemption only when returning from interrupt ?

Taeung Song treeze.taeung at gmail.com
Wed May 20 05:38:42 EDT 2020


Hi,

After reading arch/x86/entry/entry_64.S
I think preemption is checked
only when returning from interrupt (not exception like syscall)

Is is right ? (based on x86)

All scenario of checking for preemption in my opinion:
(1) check kernel preemption after interrupt
https://github.com/torvalds/linux/blob/master/arch/x86/entry/entry_64.S#L672

(2) check user preemption after interrupt
https://github.com/torvalds/linux/blob/master/arch/x86/entry/entry_64.S#L620
prepare_exit_to_usermode()
        -> exit_to_usermode_loop()
             -> if (cached_flags & _TIF_NEED_RESCHED)
                       schedule();

Thanks,
Taeung



More information about the Kernelnewbies mailing list