PERFORCE change 98413 for review
John Baldwin
jhb at FreeBSD.org
Sat Jun 3 19:15:40 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=98413
Change 98413 by jhb at jhb_mutex on 2006/06/03 19:13:52
Axe BAD_OWNER and just include MTX_UNOWNED in the mask since that
happens to work b/c rwlocks require 8-byte aligned struct threads.
Requested by: kris
Affected files ...
.. //depot/projects/smpng/sys/kern/kern_mutex.c#125 edit
Differences ...
==== //depot/projects/smpng/sys/kern/kern_mutex.c#125 (text+ko) ====
@@ -88,15 +88,10 @@
/*
* Internal utility macros.
- *
- * Note that mtx_owner() can return an invalid pointer
- * ((struct thread *)MTX_UNOWNED) if the mutex is unowned.
*/
#define mtx_unowned(m) ((m)->mtx_lock == MTX_UNOWNED)
-#define mtx_owner(m) ((struct thread *)((m)->mtx_lock & MTX_FLAGMASK))
-
-#define BAD_OWNER ((struct thread *)MTX_UNOWNED)
+#define mtx_owner(m) ((struct thread *)((m)->mtx_lock & (MTX_FLAGMASK|MTX_UNOWNED)))
#ifdef DDB
static void db_show_mtx(struct lock_object *lock);
@@ -641,11 +636,8 @@
else {
td = mtx_owner(m);
- /*
- * If we get the bad owner cookie, the
- * mutex is unlocked, so try again.
- */
- if (td == BAD_OWNER)
+ /* If the mutex is unlocked, try again. */
+ if (td == NULL)
continue;
printf(
"spin lock %p (%s) held by %p (tid %d) too long\n",
More information about the p4-projects
mailing list