Subject: Re: CPU 100% on lock on file write
To: Andrew Doran <>
From: Manuel Bouyer <>
List: tech-kern
Date: 02/21/2007 15:18:57
On Wed, Feb 21, 2007 at 11:39:01PM +1100, Daniel Carosone wrote:
> [...]
> Or maybe I'm reading too much into it, and Manuel really just wasn't
> thinking about the relative cpu cost of /dev/urandom vs /dev/zero,
> used different devices to avoid possible lock contention for the same
> device, and just picked an unfortunate example.  Manuel?  (Do we need
> /dev/one, /dev/two, etc as well? :)

I just ran this because a user reported crash on a dell 2950 doing this,
with maybe an issue in mfi(4). I was just trying to reproduce this problem,
and got surprised by the result. I didn't think about the CPU time consuption
from /dev/urandom (although it would be nice if /dev/urandom didn't need the
big lock :)

But running 2 dd from /dev/zero, the kernel seems to speed a lot of time 
spinning as well (100% CPU time for both dd, with 2 cpus 100% in kernel),
and the disk is only busy at 50% (I get twice the speed with a UP kernel).
But I guess this is expected by the current state of SMP ...

Manuel Bouyer, LIP6, Universite Paris VI. 
     NetBSD: 26 ans d'experience feront toujours la difference