public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: matthieu castet <castet.matthieu@free.fr>
To: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: High Resolution Timer DOS
Date: Sat, 28 Apr 2007 23:53:45 +0200	[thread overview]
Message-ID: <4633C269.9050806@free.fr> (raw)

Hi,

some programs need to do some short of busyloop. It was often 
implemented as :

while (1) {
	if (can_do_stuff) {
		do_stuff();
	}
	else
		//sleep a very short of time
		usleep(1);
}

usleep(1) or equivalent where used instead of sched_yield, because of 
some priority issue. IIRC doing sched_yield, make the process appears 
like an interactive process, so it has better priority and get call more 
often.

But now if high res timer are enabled, these programs while cause 
something like a DOS : the context switch per second will be bigger than 
500 000 and the cpu usage will be very high.


I don't know if such problem are already know, but I believe a warning 
about such issues should be in the Kconfig description.


Matthieu

             reply	other threads:[~2007-04-28 21:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-28 21:53 matthieu castet [this message]
2007-04-28 22:13 ` High Resolution Timer DOS Thomas Gleixner
2007-04-28 22:37   ` Lee Revell
2007-04-28 22:45     ` William Heimbigner
2007-04-29  7:17     ` Ingo Molnar
2007-04-29 16:08       ` matthieu castet
2007-04-29 16:42         ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4633C269.9050806@free.fr \
    --to=castet.matthieu@free.fr \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox