From owner-freebsd-current@FreeBSD.ORG Tue Mar 13 22:00:55 2007 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6AFD116A405 for ; Tue, 13 Mar 2007 22:00:55 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (arm132.internetdsl.tpnet.pl [83.17.198.132]) by mx1.freebsd.org (Postfix) with ESMTP id 03D5B13C44C for ; Tue, 13 Mar 2007 22:00:54 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 5D38A487FC; Tue, 13 Mar 2007 22:43:36 +0100 (CET) Received: from localhost (154.81.datacomsa.pl [195.34.81.154]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 338EE45683; Tue, 13 Mar 2007 22:43:31 +0100 (CET) Date: Tue, 13 Mar 2007 22:43:29 +0100 From: Pawel Jakub Dawidek To: Julian Elischer Message-ID: <20070313214329.GB3932@garage.freebsd.pl> References: <45F0D1F5.9010200@elischer.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+QahgC5+KEYLbs62" Content-Disposition: inline In-Reply-To: <45F0D1F5.9010200@elischer.org> X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 7.0-CURRENT i386 User-Agent: mutt-ng/devel-r804 (FreeBSD) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00 autolearn=ham version=3.0.4 Cc: FreeBSD Current Subject: Re: proc lock might become an sx lock? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Mar 2007 22:00:55 -0000 --+QahgC5+KEYLbs62 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 08, 2007 at 07:18:13PM -0800, Julian Elischer wrote: > currently the thread list in the process is protected by the sched lock. > for a process with a lot of threads this is probably not a good idea. > I experimented with making it protected by the proc loc, but the followin= g sort of thing happens a lot: >=20 > sx_slock(&allproc_lock); > FOREACH_PROC_IN_SYSTEM(p) { > mtx_lock_spin(&sched_lock); > FOREACH_THREAD_IN_PROC(p, td) { > ... > } > mtx_unlock_spin(&sched_lock); >=20 > Changing the protection of the thread list to use the proc lock would > replace the sched_lock with the proc lock, but..... > this has a problem.. the proc lock is a mutex and can therefore not be in= side the > allproc_lock. Why not? Acquiring sx lock first and then a mutex is fine. The other way around is illegal. > and in fact you get: >=20 > Trying to mount root from ufs:/dev/aacd0s1d > panic: blockable sleep lock (sleep mutex) process lock @ kern/sched_4bsd.= c:383 This is because it's order is hardcoded in subr_witness.c. Move: { "process lock", &lock_class_mtx_sleep }, a bit up and change lock_class_mtx_sleep to lock_class_sx. PS. I'm not familiar with schedulers, so I don't know if sched_lock can be replaced there. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --+QahgC5+KEYLbs62 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFF9xsBForvXbEpPzQRAhdLAKD0v/KvP8g57m2iBgHGTbb9r9RC/wCdETFJ D1jPgxen2Ik5CYh8Rd0c6Gg= =kdTY -----END PGP SIGNATURE----- --+QahgC5+KEYLbs62--