Date: Wed, 28 Jun 2006 00:44:40 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 100179 for review Message-ID: <200606280044.k5S0iea1019856@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100179 Change 100179 by kmacy@kmacy_storage:sun4v_work_sleepq on 2006/06/28 00:44:36 my token of defiance against the most foul, kludgeish artifact in the entire kernel, the lockmgr - remove the LK_INTERNAL flag as the serialization provided by the interlock is not meaningful for those already holding the lock Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/kern/kern_lock.c#4 edit .. //depot/projects/kmacy_sun4v/src/sys/sys/buf.h#4 edit .. //depot/projects/kmacy_sun4v/src/sys/sys/lockmgr.h#4 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/kern/kern_lock.c#4 (text+ko) ==== @@ -174,11 +174,6 @@ } #endif - if (flags & LK_INTERLOCK) { - mtx_assert(interlkp, MA_OWNED | MA_NOTRECURSED); - mtx_unlock(interlkp); - } - if ((flags & (LK_NOWAIT|LK_RELEASE)) == 0) WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &lkp->lk_interlock->mtx_object, @@ -468,33 +463,6 @@ return 0; } -/* - * Transfer any waiting processes from one lock to another. - */ -void -transferlockers(from, to) - struct lock *from; - struct lock *to; -{ - - KASSERT(from != to, ("lock transfer to self")); - KASSERT((from->lk_flags&LK_WAITDRAIN) == 0, ("transfer draining lock")); - - mtx_lock(from->lk_interlock); - if (from->lk_waitcount == 0) { - mtx_unlock(from->lk_interlock); - return; - } - from->lk_newlock = to; - wakeup((void *)from); - msleep(&from->lk_newlock, from->lk_interlock, from->lk_prio, - "lkxfer", 0); - from->lk_newlock = NULL; - from->lk_flags &= ~(LK_WANT_EXCL | LK_WANT_UPGRADE); - KASSERT(from->lk_waitcount == 0, ("active lock")); - mtx_unlock(from->lk_interlock); -} - /* * Initialize a lock; required before use. ==== //depot/projects/kmacy_sun4v/src/sys/sys/buf.h#4 (text+ko) ==== @@ -273,8 +273,10 @@ int s, ret; s = splbio(); - mtx_lock(bp->b_lock.lk_interlock); - locktype |= LK_INTERNAL; + /* XXX having the mutex didn't really remove the race for wmesg change + * as there may still be other sleeping on the lock even when the interlock + * mutex is held + */ bp->b_lock.lk_wmesg = buf_wmesg; bp->b_lock.lk_prio = PRIBIO + 4; ret = lockmgr(&(bp)->b_lock, locktype, interlock, curthread); @@ -293,8 +295,11 @@ int s, ret; s = splbio(); - mtx_lock(bp->b_lock.lk_interlock); - locktype |= LK_INTERNAL | LK_TIMELOCK; + /* XXX having the mutex didn't really remove the race for wmesg change + * as there may still be other sleeping on the lock even when the interlock + * mutex is held + */ + locktype |= LK_TIMELOCK; bp->b_lock.lk_wmesg = wmesg; bp->b_lock.lk_prio = (PRIBIO + 4) | catch; bp->b_lock.lk_timo = timo; ==== //depot/projects/kmacy_sun4v/src/sys/sys/lockmgr.h#4 (text+ko) ==== @@ -141,7 +141,7 @@ #define LK_HAVE_EXCL 0x00040000 /* exclusive lock obtained */ #define LK_WAITDRAIN 0x00080000 /* process waiting for lock to drain */ #define LK_DRAINING 0x00100000 /* lock is being drained */ -#define LK_INTERNAL 0x00200000/* The internal lock is already held */ +/*#define LK_INTERNAL 0x00200000 The internal lock is already held */ /* * Internal state flags corresponding to lk_sharecount, and lk_waitcount */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606280044.k5S0iea1019856>
