Date: Tue, 13 Mar 2007 22:43:29 +0100 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Julian Elischer <julian@elischer.org> Cc: FreeBSD Current <current@freebsd.org> Subject: Re: proc lock might become an sx lock? Message-ID: <20070313214329.GB3932@garage.freebsd.pl> In-Reply-To: <45F0D1F5.9010200@elischer.org> References: <45F0D1F5.9010200@elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--+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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070313214329.GB3932>