Messages in this thread | | | Date | Wed, 4 May 2011 14:11:34 +0200 | From | "Eibach, Dirk" <> | Subject | msleep() an load average |
| |
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
| |