Qustion about being "Giant-locked"

Robert Watson rwatson at freebsd.org
Tue Apr 6 09:01:11 PDT 2004

On Tue, 6 Apr 2004, Andy Farkas wrote:

> On Tue, 6 Apr 2004, Xin LI wrote:
> > On Tue, Apr 06, 2004 at 11:03:13AM +0400, Artem Koutchine wrote:
> > > While booting i see many drivers marked
> > > as [Giant-locked].
> > > Is being Giant-locked good or bad what are the
> > > implications?
> > It's not good if you have a computer with multiple processors.
> I have a box with 4 ppro-200 cpus. It has 4 adaptec eisa scsi controllers,
> each controlling 2 disks. All 8 disks are in the same vinum raid-5 volume.
> I have a large (1.5gig) file on this volume.
> This is what happens when I run md5 on this file 4 times concurrently:
> As you can see, only 8% of all cpus are being used to calculate the md5s.
> At least 2 cpus are constantly idle.

That's probably because you're mostly waiting on disks and have blindingly
fast CPUs.  However, we have some tools to help diagnose lock contention
-- in particular, you can turn on options MUTEX_PROFILING (see the man
page for details) and measure which locks are being contended.  If your
theory is right, you should see lots of contention between grabbing Giant
in the SCSI layer during interrupts, and grabbing Giant on the way into
the file system code in VFS.  If you theory is wrong, there won't be lots
of contention there.  Even if your theory is wrong, you'll probably see a
bit of contention, but not as much.

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert at fledge.watson.org      Senior Research Scientist, McAfee Research

More information about the freebsd-current mailing list