_spin_unlock_irqrestore()在我的kvm中具有很高的采样率,为什么? [英] _spin_unlock_irqrestore() has very high sampling rate in my kvm, why?
问题描述
我在KVM虚拟机中运行SPECJbb基准测试.它显示了仓库2和仓库3之间的吞吐量急剧下降(它们之间的区别只是增加了并发任务)
I run a SPECJbb benchmark in my KVM virtual machine. It shows a drastic drop on throughput between Warehouse 2 and Warehouse 3(The different between them is just addding on cocurrent task)
然后,我在来宾虚拟机中使用perf.它表明_spin_unlock_irqrestore具有很高的采样率.
Then I use perf in my guest virtual machine. It shows that _spin_unlock_irqrestore has very high sampling rate.
事件:31K周期
-
74.89%[内核] [k] _spin_unlock_irqrestore
74.89% [kernel] [k] _spin_unlock_irqrestore
7.36%perf-1968.map [.] 0x7f84b913e064
7.36% perf-1968.map [.] 0x7f84b913e064
6.82%[内核] [k] __do_softirq
6.82% [kernel] [k] __do_softirq
6.39%[内核] [k] handle_IRQ_event
6.39% [kernel] [k] handle_IRQ_event
...
运行我的Java程序似乎只占7.36%cpu的时间.为什么_spin_unlock_irqrestore的采样率如此之高?它是做什么的?
It seems that only 7.36% cpu time running my Java program. Why _spin_unlock_irqrestore's sampling rate is so high? And what does it do?
推荐答案
perf
的报告不正确,而不是_spin_unlock_irqrestore
消耗的周期.
It's bad reporting by perf
, not cycles consumed by _spin_unlock_irqrestore
.
禁用IRQ时,不会处理性能中断.而是在重新启用中断时对它们进行处理.当perf的中断处理程序查看指令指针时,要查看正在运行的代码,它会找到启用中断的函数-通常是_spin_unlock_irqrestore
.
When IRQs are disabled, perf's interrupts are not processed. Instead, they're processed when interrupts are re-enabled. When perf's interrupt handler looks at the instruction pointer, to see what code was running, it finds the function that enabled interrupts - quite often it's _spin_unlock_irqrestore
.
因此,您所知道的是,这些周期被禁用了中断的代码占用,并使用_spin_unlock_irqrestore
启用了它们.
So all you know is that the cycles were consumed by code that had interrupts disabled, and enabled them using _spin_unlock_irqrestore
.
如果您可以使用NMI(不可屏蔽中断)来获得性能,则可以解决此问题.
我知道可以通过更改makefile来使用oprofile(perf的前身)完成,但不了解perf.
If you can get perf to use NMI (non maskable interrupt), it could solve this problem.
I know that it can be done with oprofile (perf's predecessor) by changing the makefile, but don't know about perf.
这篇关于_spin_unlock_irqrestore()在我的kvm中具有很高的采样率,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!