Subject: CPU 100% on lock on file write
To: None <tech-kern@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 02/20/2007 21:59:52
Hi,
I've tried to run 2 writes to a FFS1 filesystem mounted without softdeps:
dd if=/dev/zero of=file1 bs=1024 count=500000000&
dd if=/dev/urandom of=file2 bs=1024 count=500000000&

Surprisingly, the writes are quite slow (with the drive busy at 1 to 2%)
and top show:
37 processes:  34 sleeping, 3 on processor
CPU0 states:  0.0% user,  0.0% nice,  0.5% system,  0.5% interrupt, 99.0% idle
CPU1 states:  0.5% user,  0.0% nice, 99.5% system,  0.0% interrupt,  0.0% idle
CPU2 states:  0.0% user,  0.0% nice,  0.5% system,  0.0% interrupt, 99.5% idle
CPU3 states:  0.0% user,  0.0% nice,  100% system,  0.0% interrupt,  0.0% idle
Memory: 2541M Act, 1242M Inact, 580K Wired, 4764K Exec, 3771M File, 1088K Free
Swap: 128M Total, 128M Free

  PID USERNAME PRI NICE   SIZE   RES STATE      TIME   WCPU    CPU COMMAND
  113 root      64    0    48K  576K CPU/3     12:31 100.44% 100.44% dd
  112 root      64    0    48K  576K CPU/1     12:47 100.39% 100.39% dd

I think the 2 dd commands are busy on spin locks in the kernel.
I get this with both 4.0_BETA2 and recent current.
I guess this is a showstopper for some application; is it easily fixable ?

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--