在Linux内核中支持浮点算法的开销 [英] Overhead of supporting Floating Point Arithmetic inside the Linux Kernel

查看:71
本文介绍了在Linux内核中支持浮点算法的开销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

众所周知,基于Linux/BSD的内核不支持浮点(FP)算法.在内核中处理FP寄存器的开销是多少?

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?

推荐答案

通常的答案是,如果内核不使用浮点,则不必在进入内核时保存浮点寄存器或将其恢复在出口.这样可以减少所有系统调用成本的数百个周期.

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.

我不知道是否有人试图将这种节省与性能提高进行比较,如果内核可以不加选择地使用那些寄存器,那么性能提高可能是可用的.请注意,如果您采取适当的措施,您可以 在内核中使用它们,并且这是在可获得巨大速度优势的情况下完成的,例如使用SSE指令加速memcpy等. (在Linux资源中查找对kernel_fpu_begin的调用.)

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

这篇关于在Linux内核中支持浮点算法的开销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆