public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* msleep_interruptible vs msleep
@ 2006-09-04 19:29 matthieu castet
  2006-09-04 19:38 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: matthieu castet @ 2006-09-04 19:29 UTC (permalink / raw)
  To: Linux Kernel list

Hi,

What's the difference between msleep_interruptible and msleep ?
If I understand correctly the main difference between msleep and 
msleep_interruptible is that msleep_interruptible can return if there is 
a pending signal ?

But why if I have a kernel thread that do [1] :

while (true) {
Do some stuff
msleep(1000)
}

the load average is high (near 100%).

and if I use msleep_interruptible the load average is normal.

Does the same applies to wait_event_timeout vs 
wait_event_interruptible_timeout ?

Thanks,

Matthieu CASTET

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: msleep_interruptible vs msleep
  2006-09-04 19:29 msleep_interruptible vs msleep matthieu castet
@ 2006-09-04 19:38 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2006-09-04 19:38 UTC (permalink / raw)
  To: matthieu castet; +Cc: Linux Kernel list

Am Monday 04 September 2006 21:29 schrieb matthieu castet:
>
> But why if I have a kernel thread that do [1] :
>
> while (true) {
> Do some stuff
> msleep(1000)
> }
>
> the load average is high (near 100%).
>
> and if I use msleep_interruptible the load average is normal.

These are the traditional semantics of incorruptible vs. noninterruptible
sleep. A process that sleep noninterruptible contributes to the load
average but does not consume actual CPU cycles.

I guess you can take that as a hint that the code you're describing
above is a bad thing to do.

> Does the same applies to wait_event_timeout vs
> wait_event_interruptible_timeout ?

yes.

	Arnd <><

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-04 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-04 19:29 msleep_interruptible vs msleep matthieu castet
2006-09-04 19:38 ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox