alistair23-linux/arch
Oleg Nesterov f1853505d9 x86, fpu: copy_process: Avoid fpu_alloc/copy if !used_math()
arch_dup_task_struct() copies thread.fpu if fpu_allocated(), this
looks suboptimal and misleading. Say, a forking process could use
FPU only once in a signal handler but now tsk_used_math(src) == F,
in this case the child gets a copy of fpu->state for no reason. The
child won't use the saved registers anyway even if it starts to use
FPU, this can only avoid fpu_alloc() in do_device_not_available().

Change this code to check tsk_used_math(current) instead. We still
need to clear fpu->has_fpu/state, we could do this memset(0) under
fpu_allocated() check but I think this doesn't make sense. See also
the next change.

use_eager_fpu() assumes that fpu_allocated() is always true, but a
forking task (and thus its child) must always have PF_USED_MATH set,
otherwise the child can either use FPU without used_math() (note that
switch_fpu_prepare() doesn't do stts() in this case), or it will be
killed by do_device_not_available()->BUG_ON(use_eager_fpu).

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Link: http://lkml.kernel.org/r/20140902175723.GA21659@redhat.com
Reviewed-by: Suresh Siddha <sbsiddha@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-09-02 14:51:16 -07:00
..
alpha alpha: io: implement relaxed accessor macros for writes 2014-08-29 11:18:45 -07:00
arc flush_icache_range: export symbol to fix build errors 2014-08-29 16:28:17 -07:00
arm Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm 2014-08-31 17:02:57 -07:00
arm64 Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-08-24 16:17:41 -07:00
avr32 Merge branch 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2014-08-09 09:58:12 -07:00
blackfin Merge branch 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2014-08-09 09:58:12 -07:00
c6x Merge branch 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2014-08-09 09:58:12 -07:00
cris Merge branch 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2014-08-09 09:58:12 -07:00
frv frv: Define cpu_relax_lowlatency() 2014-08-19 09:40:08 -05:00
hexagon flush_icache_range: export symbol to fix build errors 2014-08-29 16:28:17 -07:00
ia64 kexec: remove CONFIG_KEXEC dependency on crypto 2014-08-29 16:28:16 -07:00
m32r Merge branch 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2014-08-09 09:58:12 -07:00
m68k kexec: remove CONFIG_KEXEC dependency on crypto 2014-08-29 16:28:16 -07:00
metag Metag architecture changes for v3.17 2014-08-13 18:18:09 -06:00
microblaze microblaze: Wire-up memfd_create syscall 2014-08-21 10:19:28 +02:00
mips kexec: remove CONFIG_KEXEC dependency on crypto 2014-08-29 16:28:16 -07:00
mn10300 Merge branch 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2014-08-09 09:58:12 -07:00
openrisc Merge branch 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2014-08-09 09:58:12 -07:00
parisc Merge branch 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2014-08-09 09:58:12 -07:00
powerpc kexec: remove CONFIG_KEXEC dependency on crypto 2014-08-29 16:28:16 -07:00
s390 kexec: remove CONFIG_KEXEC dependency on crypto 2014-08-29 16:28:16 -07:00
score Merge branch 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2014-08-09 09:58:12 -07:00
sh flush_icache_range: export symbol to fix build errors 2014-08-29 16:28:17 -07:00
sparc sparc: Hook up memfd_create system call. 2014-08-13 22:00:09 -07:00
tile flush_icache_range: export symbol to fix build errors 2014-08-29 16:28:17 -07:00
um Merge branch 'signal-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/misc 2014-08-09 09:58:12 -07:00
unicore32 unicore32: Fix build error 2014-08-31 17:08:12 -07:00
x86 x86, fpu: copy_process: Avoid fpu_alloc/copy if !used_math() 2014-09-02 14:51:16 -07:00
xtensa Xtensa improvements for 3.17: 2014-08-31 17:08:42 -07:00
.gitignore
Kconfig seccomp: add "seccomp" syscall 2014-07-18 12:13:37 -07:00