nanosleep high CPU load

I seem to be having a problem with nanosleep in v11 of SUSE (and other recent Linux flavours).

I made a very simple test program that just endlessly calls nanosleep with a time of 1000 nanoseconds. The newer versions of Linux show a pretty significant CPU load (as reported by top). The same program on an older version of Linux shows virtually no CPU load.

For example:
openSUSE 10.3: does not show up in the list shown from top
openSUSE 11.0: 40% CPU usage
openSUSE 11.1: 35% CPU usage

I have also observed the same high CPU load with Ubuntu 8.04 and Fedora 9. The key thing I have observed is that any version of Linux I have tried with a kernel version of 2.6.22 or lower will show essentially no CPU load. The newer kernel versions will show significant load. Has anybody else observed this?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Reminds me of this:

http://it.slashdot.org/it/07/07/11/1421209.shtml

As I recall a different scheduler could show the problem, so perhaps that
changed around 2.6.22?

Good luck.

longislandkm wrote:
> I seem to be having a problem with nanosleep in v11 of SUSE (and other
> recent Linux flavours).
>
> I made a very simple test program that just endlessly calls nanosleep
> with a time of 1000 nanoseconds. The newer versions of Linux show a
> pretty significant CPU load (as reported by top). The same program on
> an older version of Linux shows virtually no CPU load.
>
> For example:
> openSUSE 10.3: does not show up in the list shown from top
> openSUSE 11.0: 40% CPU usage
> openSUSE 11.1: 35% CPU usage
>
> I have also observed the same high CPU load with Ubuntu 8.04 and Fedora
> 9. The key thing I have observed is that any version of Linux I have
> tried with a kernel version of 2.6.22 or lower will show essentially no
> CPU load. The newer kernel versions will show significant load. Has
> anybody else observed this?
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJKV8MTAAoJEF+XTK08PnB5aVAP/ieXpbjqkqQuppu0rmjaJ4/F
yQBPmvym5EVbncN+86x0qeA81hG3qSfwoOdNgpB9qFzL4g0j6tj8apEQoheLhnCr
3Wf5+oV4fWxa8I6FEEXO13tz30F9DdGZHwvAsuMlF44/A51X6BG00l+Iyo9X20sK
92GIXt2eIquaIrRw2VLQfvAiHC8dekTkMW5uYSAzBxb1dYzG5a/hWO+yJhfqH7bC
IwUYkz+pzDWipVR+TZVKGd71FOR9f/mH66gHvkQw5lCoBMTHcWZegjVUeHboFmyh
4O+KnwNiiwtbPs5Bmpgzs4SmV34ob513BdcDPQLNNU6EppEfvFPyamBTn1+uNXoI
nsGWfjRC+dcVvpJB7b7g3JO/pNPWUVEENp0NBbbuWO9LbJtYEO2WAbIHW6bbNLTw
dAdgtNUy/7qqY66rarckqHH7ZMkrvos7hOFE/B3W5zW/NEUrmXX8E57VAZrX+hGR
Nztf+5yE8dCH/YYxNq0K4d+p3XJVwwKyXZdhz3hmvJfU0DISJt1mzclSId6YT/zs
0B9CVOXwCEDf0wrp/0BIVk5W2c+CLnZ+IiFWx70UtOS7USg00yqHXQ7P1E+S0yut
dNZtXa6kw8sSQWhzbS/91u2zWXrw3RdOwMKJLx6Z/n7PoHoPK8oyzaBvyRmYTcl2
ofTeRhkqzYRQnJLRuQVa
=mp62
-----END PGP SIGNATURE-----