Linux调度程序是否意识到硬件中断(调度程序抖动)
如果一个进程被硬件中断(第一级中断处理程序)中断,那么CPU调度程序是否会意识到这一点(例如,调度程序是否与被中断的进程分开计算硬件中断的执行时间)?
更多详情: 我正在尝试解决以下问题:对于指定的数据包加密任务,htop 中的 CPU 利用率太低(以 400Mbps 加密数据包时,CPU 利用率低于 10%;原始加密速度仅为 1.6Gbps,因此数据包加密不应继续)任何比原始加密速度更快的速度)。
解释: 我的假设是数据包封装发生在硬件中断时,因此给我一种 htop 中 CPU 使用率较低的错觉。通常,FLIH 的实现是为了尽快完成任务,并将工作推迟到 SLIH(二级中断处理程序,我猜是代表 ksoftirqd/X 执行的)。但是如果 FLIH 中断进程很长时间会发生什么?这是否会引入某种操作系统抖动?
我在 x86-64 平台上使用 Ubuntu 10.04.1。
附加调试信息:
while [ 1 ]; do cat /proc/stat | grep "cpu "; sleep 1; done;
cpu 288 1 1677 356408 1145 0 20863 0 0
cpu 288 1 1677 356772 1145 0 20899 0 0
cpu 288 1 1677 357108 1145 0 20968 0 0
cpu 288 1 1677 357392 1145 0 21083 0 0
cpu 288 1 1677 357620 1145 0 21259 0 0
cpu 288 1 1677 357972 1145 0 21310 0 0
cpu 288 1 1677 358289 1145 0 21398 0 0
cpu 288 1 1677 358517 1145 0 21525 0 0
cpu 288 1 1678 358838 1145 0 21652 0 0
cpu 289 1 1678 359141 1145 0 21704 0 0
cpu 289 1 1678 359563 1145 0 21729 0 0
cpu 290 1 1678 359886 1145 0 21758 0 0
cpu 290 1 1678 360296 1145 0 21801 0 0
第七(或第六列)列我猜是在硬件中断处理程序中花费的时间(htop 使用此 proc 文件来获取统计信息)。我想知道这是否最终会成为 linux 或驱动程序中的错误。当我拍摄这些 /proc/stat 快照时,流量的输入速度为 500Mbps,输出速度为 500Mbps。
If a process is interrupted by a hardware interrupt (First Level Interrupt Handler), then does the CPU scheduler becomes aware of that (e.g. Does the Scheduler count execution time for hardware interrupts separately from interrupted process)?
More details:
I am trying to troubleshoot an issue where CPU utilization in htop is way too low for the specified packet encryption task (CPU is at <10% while encrypting packets at 400Mbps; Raw encryption speed is only 1.6Gbps, so packet encryption should not go any faster than raw encryption speed).
Explanation:
My hypothesis is that packet encapsulation happens at hardware interrupts hence giving me the illusion of the low CPU usage in htop. Usually FLIHs are implemented so that they finish their task as quickly as possible and defer their work to SLIHs (Second Level Interrupt Handler which I guess is executed on behalf of ksoftirqd/X). But what happens if FLIH interrupts a process for a very long time? Does that introduce some kind of a OS jitter?
I am using Ubuntu 10.04.1 on x86-64 platform.
Additional debugging info:
while [ 1 ]; do cat /proc/stat | grep "cpu "; sleep 1; done;
cpu 288 1 1677 356408 1145 0 20863 0 0
cpu 288 1 1677 356772 1145 0 20899 0 0
cpu 288 1 1677 357108 1145 0 20968 0 0
cpu 288 1 1677 357392 1145 0 21083 0 0
cpu 288 1 1677 357620 1145 0 21259 0 0
cpu 288 1 1677 357972 1145 0 21310 0 0
cpu 288 1 1677 358289 1145 0 21398 0 0
cpu 288 1 1677 358517 1145 0 21525 0 0
cpu 288 1 1678 358838 1145 0 21652 0 0
cpu 289 1 1678 359141 1145 0 21704 0 0
cpu 289 1 1678 359563 1145 0 21729 0 0
cpu 290 1 1678 359886 1145 0 21758 0 0
cpu 290 1 1678 360296 1145 0 21801 0 0
Seventh (or sixth number column) column here I guess is the time spent inside Hardware interrupt handlers (htop uses this proc file to get statistics). I am wondering if this will end up as a bug in linux or the driver. When I took these /proc/stat snapshots the traffic was going at 500Mbps in and 500Mbps out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
计算中断处理程序所花费的时间。
htop 在“si”(软中断)和“hi”(硬中断)中显示它。 ni 很好,wa 是 io-wait。
编辑:
从 man proc 中:
第六列是硬件中断时间,
第七列是软中断时间,
第八列是被盗时间,
第九列是来宾时间。
后两者仅对虚拟化系统有意义。
您是否有使用 CONFIG_IRQ_TIME_ACCOUNTING(处理器类型和功能/细粒度任务级 IRQ 时间统计)选项集构建的内核?
The time spent in interrupt handlers is accounted.
htop shows it in "si" (soft interrupt) and "hi" (hard interrupt). ni is nice and wa is io-wait.
Edit:
From man proc:
sixth column is hardware irq time
seventh column is softirq
eight is stolen time
nienth is guest time.
the latter two are only meaningful for virtualized systems.
Do you have a kernel built with the CONFIG_IRQ_TIME_ACCOUNTING (Processor type and features/Fine granularity task level IRQ time accounting) option set?