Test files and logs are available in GitHub
Up to now I still don't know clearly whether this is simply a display issue, or something is actually being executed.
- Even with the issue happening, the application seems works normally.
- But with previous perf report, the data sampling rate when the issue happen is higher than the rate when issue not happen.
Forcing context tracking only works until 4.5, doing so on 4.6 and after still see the issue.
Random abnormal high CPU sys usage related to timer
We were having issue with our userspace application which
__sometimes__ result in high CPU sys usage at each execution. The high
sys CPU usage persist until the application is killed.
We simplified the application to just creating a timer and its handler
then does nothing, but looping and sleeping for the timer to be
triggered. With top, the CPU that running the application usually
takes almost 0% for sys usage. But sometimes it will occupy certain
amount of sys usage, up to 100% at most of the time on my embedded
On my laptop, Intel Core i5-4200U, running Ubuntu 14.02.2, Linux
3.13.0-45-generic and 4.4.0-34-generic, the issue can be reproduced
with lower sys usage (7~50%). The same can be reproduced with
buildroot+vanilla kernel 4.7 and 3.13.
Restart the application could temporarily fix the the issue, but there
are chances to happen again.
Comparing the good and fail log got the following
- The /proc/timer_stats is almost the same, but perf events shows extra softirq/timer events.
- The perf sample of the failed case is much more than the good case, but the ratio of the sampled functions are basically the same.
One issue is found that seems related, but no further action.
Keystone II Linux: Random High CPU usage - userspace application using 1 full core - Linux forum - Linux - TI E2E Community
The Documentation/cpu-load.txt discussed a situation that the cpu load reported by top might underestimated. The C code is very alike to ours. But it's discussing a different topic.
Why you should avoid using SIGALRM for timer – Linux, Embedded, Android and Security blog
Linux timer | 菜鳥的三年成長史
The best timer | 菜鳥的三年成長史
Linux Timers | Blog | Upvoid