Bug 139324
Summary: | A simple timer implementation cause high CPU usage periodically | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 3 | Reporter: | Willy Gao <gao> | ||||
Component: | kernel | Assignee: | Ingo Molnar <mingo> | ||||
Status: | CLOSED NOTABUG | QA Contact: | Brian Brock <bbrock> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 3.0 | CC: | petrides, riel | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | i686 | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2005-09-15 18:58:56 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Willy Gao
2004-11-15 07:18:34 UTC
Created attachment 106698 [details]
sample source(c)
I believe this is just about kernel process time accounting. Kernel samples at 100Hz, so if you are unlucky enough (and the interval you are using in the test program is exactly 10msec) it can be seen as busy during several samplings even if the process most of the remaining 10msec sleeps. You can run oprofile or some other tool to see that the program really is not taking too much CPU. Hi, We found it can be reproduced even by using a nanosleep or select in a forever loop, and even the interval is not 10ms. #include <sys/select.h> int main() { while (1) { struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 50000; select(0, 0, 0, 0, &tv); } } Since the process is idle in most of the time, opofile also shows a reasonable number. But actually the system becomes busy when a lot of such processes started, for example the GUI operation. And one more strange thing is that even lots of such processes are started at different time, all processes's CPU usage rises at the same time. Actually it seems something related with the kernel sampling time but we can not see the problem on any AS2 machines (and SuSE9). all timers (even nanosleep) have a basic granularity of 10 msecs - so purely timer-driven workloads might be under or over-sampled by the CPU utilization measurement code. This is standard Linux behavior. |