Skip to content

Commit

Permalink
x86/fpu: Simplify fpregs_[un]lock()
Browse files Browse the repository at this point in the history
There is no point in disabling preemption and then disabling bottom
halfs.

Just disabling bottom halfs is sufficient as it implicitly disables
preemption on !RT kernels.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20201027101349.455380473@linutronix.de
  • Loading branch information
Thomas Gleixner committed Nov 11, 2020
1 parent f8394f2 commit 5f0c712
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/x86/include/asm/fpu/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,18 @@ extern void fpregs_mark_activate(void);
* A context switch will (and softirq might) save CPU's FPU registers to
* fpu->state and set TIF_NEED_FPU_LOAD leaving CPU's FPU registers in
* a random state.
*
* local_bh_disable() protects against both preemption and soft interrupts
* on !RT kernels.
*/
static inline void fpregs_lock(void)
{
preempt_disable();
local_bh_disable();
}

static inline void fpregs_unlock(void)
{
local_bh_enable();
preempt_enable();
}

#ifdef CONFIG_X86_DEBUG_FPU
Expand Down

0 comments on commit 5f0c712

Please sign in to comment.