]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/x86/kernel/process.h
x86/process: Consolidate and simplify switch_to_xtra() code
[mirror_ubuntu-bionic-kernel.git] / arch / x86 / kernel / process.h
1 // SPDX-License-Identifier: GPL-2.0
2 //
3 // Code shared between 32 and 64 bit
4
5 void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p);
6
7 /*
8 * This needs to be inline to optimize for the common case where no extra
9 * work needs to be done.
10 */
11 static inline void switch_to_extra(struct task_struct *prev,
12 struct task_struct *next)
13 {
14 unsigned long next_tif = task_thread_info(next)->flags;
15 unsigned long prev_tif = task_thread_info(prev)->flags;
16
17 /*
18 * __switch_to_xtra() handles debug registers, i/o bitmaps,
19 * speculation mitigations etc.
20 */
21 if (unlikely(next_tif & _TIF_WORK_CTXSW_NEXT ||
22 prev_tif & _TIF_WORK_CTXSW_PREV))
23 __switch_to_xtra(prev, next);
24 }