Check for preemption only when returning from interrupt ?

Taeung Song <[email protected]> Wed, 20 May 2020 16:03:29 +0900
Newsgroups org.kernel.vger.linux-newbie
Message-ID <[email protected]>
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