lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 4 May 2011 14:11:34 +0200
From:	"Eibach, Dirk" <Eibach@...ys.de>
To:	<linux-kernel@...r.kernel.org>
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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ