Skip to contentSkip to conversation

msleep_interruptible vs msleep

DISCUSSION matthieu castet 2 participants 2 messages Sep 4, 2006

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

Am Monday 04 September 2006 21:29 schrieb matthieu castet:

Quoted 11 lines

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.

Quoted 2 lines

Does the same applies to wait_event_timeout vs
wait_event_interruptible_timeout ?

yes.

	Arnd <><