Overhead of supporting Floating Point Arithmetic inside the Linux Kernel

后端 未结 1 553
北荒
北荒 2021-01-19 06:42

It is known that floating point (FP) arithmetic is not supported inside the Linux/BSD based kernels. What\'s the overhead of dealing with FP registers inside the kernel?

相关标签:
1条回答
  • 2021-01-19 07:00

    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.)

    0 讨论(0)
提交回复
热议问题