为什么硬件中断比较高的时候,网络传输所用的软中断会增加得比普通情况下多很多啊?

2022-03-24 08:59:46 +08:00
 LwZiye
最近查 cpu 占用问题,遇到系统负荷高得时候,发现软中断占用特别高;但是如果整体 cpu 占用比较低的时候,软中断占用就表现比较正常。
PS: 有没有大佬知道怎么查此类 CPU 占用问题呢,小弟不胜感激。
1226 次点击
所在节点    问与答
5 条回复
cubecube
2022-03-24 10:43:00 +08:00
有没有一种可能,cpu 占用低的时候,软中断处理速率快,没堆积?
LwZiye
2022-03-24 11:26:40 +08:00
@cubecube 倒是有看到过类似的说法,说软中断属于处理的下半部什么的。
weiping1992
2022-03-24 12:17:53 +08:00
我没太明白你的问题。收取网络报文有两个阶段,一个是硬件网卡通知内核有数据到达;另一个过程是内核将内核空间的数据报文拷贝到应用程序的用户空间中。后者应该就是你说的软件中断吧
Srar
2022-03-25 02:41:33 +08:00
猜测可能是硬件多次中断在短时间内会合并成一个中断来通知,这个是 intel 网卡关于中断合并的表述:

```
When an event occurs, the adapter generates an interrupt, which allows the driver to handle the packet. At greater link speeds, more interrupts are created, and CPU rates also increase. This results in poor system performance. When you use a higher ITR setting, the interrupt rate is lower, and the result is better system performance.
```
LwZiye
2022-03-25 08:55:49 +08:00
@weiping1992 看起来是的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/842508

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX