V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
LwZiye
V2EX  ›  问与答

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

  •  
  •   LwZiye · 2022-03-24 08:59:46 +08:00 · 1202 次点击
    这是一个创建于 757 天前的主题,其中的信息可能已经有所发展或是发生改变。
    最近查 cpu 占用问题,遇到系统负荷高得时候,发现软中断占用特别高;但是如果整体 cpu 占用比较低的时候,软中断占用就表现比较正常。
    PS: 有没有大佬知道怎么查此类 CPU 占用问题呢,小弟不胜感激。
    5 条回复    2022-03-25 08:55:49 +08:00
    cubecube
        1
    cubecube  
       2022-03-24 10:43:00 +08:00
    有没有一种可能,cpu 占用低的时候,软中断处理速率快,没堆积?
    LwZiye
        2
    LwZiye  
    OP
       2022-03-24 11:26:40 +08:00
    @cubecube 倒是有看到过类似的说法,说软中断属于处理的下半部什么的。
    weiping1992
        3
    weiping1992  
       2022-03-24 12:17:53 +08:00 via Android
    我没太明白你的问题。收取网络报文有两个阶段,一个是硬件网卡通知内核有数据到达;另一个过程是内核将内核空间的数据报文拷贝到应用程序的用户空间中。后者应该就是你说的软件中断吧
    Srar
        4
    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
        5
    LwZiye  
    OP
       2022-03-25 08:55:49 +08:00
    @weiping1992 看起来是的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5592 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 06:28 · PVG 14:28 · LAX 23:28 · JFK 02:28
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.