FreeBSD: Don't save user FPU context in kernel threads
Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Ryan Moeller <freqlabs@FreeBSD.org> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #10899
This commit is contained in:
parent
b199e62d17
commit
227273efa4
|
@ -29,6 +29,7 @@
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
|
#include <sys/proc.h>
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
#include <x86/fpu.h>
|
#include <x86/fpu.h>
|
||||||
#else
|
#else
|
||||||
|
@ -43,14 +44,13 @@
|
||||||
#define kfpu_initialize(tsk) do {} while (0)
|
#define kfpu_initialize(tsk) do {} while (0)
|
||||||
|
|
||||||
#define kfpu_begin() { \
|
#define kfpu_begin() { \
|
||||||
critical_enter(); \
|
if (__predict_false(!is_fpu_kern_thread(0))) \
|
||||||
fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX);\
|
fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX);\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define kfpu_end() \
|
#define kfpu_end() { \
|
||||||
{ \
|
if (__predict_false(curpcb->pcb_flags & PCB_FPUNOSAVE)) \
|
||||||
fpu_kern_leave(curthread, NULL); \
|
fpu_kern_leave(curthread, NULL); \
|
||||||
critical_exit(); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -169,6 +169,10 @@ taskq_tsd_set(void *context)
|
||||||
{
|
{
|
||||||
taskq_t *tq = context;
|
taskq_t *tq = context;
|
||||||
|
|
||||||
|
#if defined(__amd64__) || defined(__i386__) || defined(__aarch64__)
|
||||||
|
if (context != NULL && tsd_get(taskq_tsd) == NULL)
|
||||||
|
fpu_kern_thread(FPU_KERN_NORMAL);
|
||||||
|
#endif
|
||||||
tsd_set(taskq_tsd, tq);
|
tsd_set(taskq_tsd, tq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue