Overhead of supporting Floating Point Arithmetic inside the Linux Kernel
It is known that floating point (FP) arithmetic is n开发者_Go百科ot supported inside the Linux/BSD based kernels. What's the overhead of dealing with FP registers inside the kernel?
The usual answer is that if the kernel does not use floating point, it does not have to save the floating-point registers on entry to the kernel or restore them on exit. This shaves several hundred cycles off the cost of all system calls.
I do not know if anyone has tried to compare this savings against the performance improvements that might be available if the kernel could make indiscriminate use of those registers. Note that you can use them in the kernel if you take proper care, and this is done in contexts where tremendous speed benefits are available, e.g. using SSE instructions to accelerate memcpy
and the like. (Look for calls to kernel_fpu_begin
in the Linux sources.)
精彩评论