LOCK_PROFILING confusion

John Polstra jdp at polstra.com
Mon Dec 4 14:58:52 PST 2006


I'm having trouble making sense of the output generated by
LOCK_PROFILING -- in particular, the cnt_hold and cnt_lock stats.
The man page says:

     cnt_hold  The number of times the lock was held and another
               thread attempted to acquire the lock.

     cnt_lock  The number of times the lock was already held when this
               point was reached.

When I enable lock profiling for 30 seconds during heavy network
activity and then look at all of the lines for the sched lock, I see a
lot of non-zero values in the cnt_hold column (including several over
100000 and one over 500000).  But all of the values in the cnt_lock
column are 0.  How can that be?  It seems to me that for a given
lock, the two columns should sum to the same number -- except maybe
for recursive acquisitions, which might increase the cnt_lock numbers
without increasing the cnt_hold numbers.  (The descriptions don't say
what happens with recursive acquisitions.)

What am I missing?

John


More information about the freebsd-current mailing list