Currently there are 2 fpu users in the kernel: raid5 checksumming and 3dnow memcpy/memset. raid5 checksumming is not problematic, but _mmx_memcpy() has unexpected side effects if someone else is also using the fpu: memcopy is a really generic function, and calling it saves the current fpu state into thread.i387.f{,x}save. IMHO that's wrong, memcopy must save into a local buffer like raid5 checksumming. I've attached a proposal that supports arbitrary combinations of fpu users in kernel space. * kernel threads can use the fpu freely. Nothing new. * 2 sets of functions for fpu usage in "normal" threads: - kfpu_acquire(), kfpu_try_acquire() + release functions. - kfpu_full_begin(), kfpu_mmx_begin(), kfpu_nosave_begin(), kfpu_try_begin() + _end() functions. The first set is only possible from normal process context. The caller can sleep between _acquire() and _release(). The second set can be called from arbitrary context, but the caller must not sleep between _begin() and _end(). The _try() functions check if the fpu is unused, and fail if the fpu is currently in use. That way the memcpy()/memset() functions can avoid fpu context saves/restores and it saves stack space. Nesting is partially possible: _begin() within _acquire is possible, _acquire() within _begin() will BUG. [_acquire()/_release() have similar restrictions as down() and up(), _begin()/_end() have similar restrictions as spinlocks] The patch itself is alpha quality: only the sse functions are tested, it boots when compiled for Pentium III, the raid5 checksum _benchmark_ still works and distributed.net still cracks rc5. I haven't yet checked that the exception handlers are still called properly. What do you think? -- Manfred