From owner-cvs-all@FreeBSD.ORG Sat Jan 24 17:59:28 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4FDF216A4CE; Sat, 24 Jan 2004 17:59:28 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 653C443D41; Sat, 24 Jan 2004 17:59:27 -0800 (PST) (envelope-from rwatson@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i0P1xR0B039362; Sat, 24 Jan 2004 17:59:27 -0800 (PST) (envelope-from rwatson@repoman.freebsd.org) Received: (from rwatson@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i0P1xR4i039361; Sat, 24 Jan 2004 17:59:27 -0800 (PST) (envelope-from rwatson) Message-Id: <200401250159.i0P1xR4i039361@repoman.freebsd.org> From: Robert Watson Date: Sat, 24 Jan 2004 17:59:27 -0800 (PST) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/sys _mutex.h src/sys/kern kern_mutex.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2004 01:59:28 -0000 rwatson 2004/01/24 17:59:27 PST FreeBSD src repository Modified files: sys/sys _mutex.h sys/kern kern_mutex.c Log: Add some basic support for measuring sleep mutex contention to the mutex profiling code. As with existing mutex profiling, measurement is done with respect to mtx_lock() instances in the code, as opposed to specific mutexes. In particular, measure two things: (1) Lock contention. How often did this mtx_lock() call get made and have to sleep (or almost sleep) waiting for the lock. This helps identify the "victims" of contention. (2) Hold contention. How often, while the lock was held by a thread as a result of this mtx_lock(), did another thread try to acquire the same mutex. This helps identify the causes of contention. I'm currently exploring adding measurement of "time waited for the lock", but the current implementation has proven useful to me so far so I figured I'd commit it so others could try it out. Note that this increases the size of mutexes when MUTEX_PROFILING is enabled, so you might find you need to further bump UMA_BOOT_PAGES. Fixes welcome. The once over: des, others Revision Changes Path 1.134 +33 -5 src/sys/kern/kern_mutex.c 1.11 +9 -0 src/sys/sys/_mutex.h