All of lore.kernel.org
 help / color / mirror / Atom feed
* msleep() an load average
@ 2011-05-04 12:11 Eibach, Dirk
  2011-05-04 13:37 ` Jiri Slaby
  2011-05-04 13:47 ` Clemens Ladisch
  0 siblings, 2 replies; 7+ messages in thread
From: Eibach, Dirk @ 2011-05-04 12:11 UTC (permalink / raw)
  To: linux-kernel


LDD Chapter 7 says "In general, if you can tolerate longer delays than
requested, you should use schedule_timeout, msleep or ssleep.".

Following this rule, my kernel thread does:
while(1) msleep(1000);

Seconds later userspace guys start whining: "Your driver is evil,
loadavg is 1 and we did not even start our fancy application".

I say: "No, my code is perfectly fine, I followed LDD to the letter."

So the userspace guys head back to their cave, only to return after 5
hours of googling: "Hey, we know what you are doing. Your kernel thread
does uninterruptible sleeps. Wikipedia says, this means you are probably
waiting for disk activity."

Since I don't like having those whining userspace guys around I change
my code, reluctantly:
while(1) msleep_interruptible(1000);

Seconds later they say: "All hail great kernel hacker! You fixed it in
no time."

I appreciate their admiration, but still there are doubts in my mind: Is
this code really any better? Is the loadavg metric broken beyond repair?
Should I really avoid msleep, just to stop those userspace guys from
whining?
The truth must be out there ...

Cheers
Dirk



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

end of thread, other threads:[~2011-05-04 14:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-04 12:11 msleep() an load average Eibach, Dirk
2011-05-04 13:37 ` Jiri Slaby
2011-05-04 13:54   ` Eibach, Dirk
2011-05-04 14:30     ` Clemens Ladisch
2011-05-04 14:47       ` Eibach, Dirk
2011-05-04 13:47 ` Clemens Ladisch
2011-05-04 14:04   ` Eibach, Dirk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.