Re: Top command issue in kernel 2.6.16 and some kernel 2.4.16



John <nyrinwi@xxxxxxxxx> writes:

karnan wrote:
We have our application in user space and driver in kernel space.
There is block read to get the data from kernel space to user space.
When we use Top command to measure it show 0% for 60 seconds and 99%
for 30 seconds and it repeats. But my code should always take about
30% of CPU all the time because this works based on real time data
available from kernel driver. Can anybody help to understand why top
is showing 0% while I know that app should take about 30%. why is
showing 99%? Is there any area I need to look at for this 99%
occupancy?
We tested in both kernel 2.6 and 2.4. This issue happens in all
platform for kernel 2.6. In case of kernel 2.4, this happens only in
one platform. In other platform, tops shows correctly 30% all the
time.
Could anybody explain what could wrong here?

Hard to say without more details. What is your user space code doing
for these 60 seconds that top indicates 0%? If top says 0%, then I
would expect to find the user space code sleeping or blocking in a
driver call. gdb or strace should be able to tell you.

The fact that the overall numbers add up to what you expect (30 sec
active and 60 sec idle = 33% active) leads me to believe that top is
not broken. Instead, your application is not behaving the way you
thought it would.

This belief may also be quite wrong. The periodic loads (when load is
calculated via `/proc/uptime' or `/proc/stat') is something i have
witnessed quite often, basically the information kernel exports to
those files should not be used to accurately measure CPU utilization
for certain types of activity.

A sample of the user space code would help.

Indeed.

--
vale
.



Relevant Pages

  • Re: Checkpoint/restart (was Re: [PATCH 0/4] - v2 - Object creation with a specified id)
    ... kernel representation. ... If the state can be inferred from user space it is visible to user ... In the worst case today we can restore a checkpoint by replaying all of ... Checkpoints coordinated between multiple containers or real ...
    (Linux-Kernel)
  • Re: [OT] ALSA userspace API complexity
    ... Why we have X servers in user space (and only some supporting code is in the kernel) then? ... Can you do this with ALSA way? ... comercial OSS have ALSA emulation and ALSA have OSS emulation. ...
    (Linux-Kernel)
  • Re: Things that Longhorn seems to be doing right
    ... Updating a user space database every time ... >is just as bad as putting an SQL optimizer into the kernel. ... Well, since I don't think that SQL belongs in the filesystem, and I ...
    (Linux-Kernel)
  • Re: syscalls implementation
    ... In user space, the system calls are stubs in a library that traps into ... the vector code generated from syscalls.master in the kernel. ... stack, and then a trap is issued by ... argument pointer are passed to the system call. ...
    (freebsd-hackers)
  • Re: [OT] ALSA userspace API complexity
    ... >> It means that you are saying that kernel should be bigger and bigger. ... Why we have X servers in user space (and ... > All abstraction are NOW coded but some parts of this abstraction are on ... > If you have sound device without this soft mixing is moved to user space ...
    (Linux-Kernel)