Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Jun 2006 19:14:00 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 98413 for review
Message-ID:  <200606031914.k53JE0vw077822@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=98413

Change 98413 by jhb@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",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606031914.k53JE0vw077822>