Subject: Re: Floating point in the kernel
To: Andrei Petrov <>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-kern
Date: 09/18/1998 16:00:01
>I assume if you use fp in kernel you should be responsible for all
>what you ment ioned before, also I don't think kernel is the good
>place for math. One thing I wouldn't do is fp save/restore during
>process context switch only; I think that safer to mark processes
>which u se fpu and make fp save/restore only for them, shouldn't be
>much overhead; then you would be mor e protected from lkm who wants

If you already have lazy-evaluation of an FP context switch, this
isn't too bad.  I ported the FreeBSD code which uses the FPU to do
copyin/copyout on Intel Pentium; a modest (~5%) speedup.

The problem starts when you need two, or three such inkernel FPU
users. They all need to know about each other.  Faking up a process
and FPU context for each might be OK.

If in-kernel FPU really is necessary. (For sw modems, the total
context-switch latency might mean inkernel FPU is a win over userspace
even with RT scheduling -- esp. on machines with single-context MMUs
or caches.)