Module Name:    src
Committed By:   ad
Date:           Sat Jan 25 17:58:28 UTC 2020

Modified Files:
        src/lib/libpthread: pthread_mutex.c

Log Message:
pthread__mutex_unlock_slow(): ignore the DEFERRED bit.  It's only purpose
is to get the thread to go through the slow path.  If there are waiters,
process them there and then.  Should not affect well behaved apps.  Maybe
of help for:

PR bin/50350: rump/rumpkern/t_sp/stress_{long,short} fail on Core 2 Quad


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/lib/libpthread/pthread_mutex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpthread/pthread_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.66 src/lib/libpthread/pthread_mutex.c:1.67
--- src/lib/libpthread/pthread_mutex.c:1.66	Mon Jan 13 18:22:56 2020
+++ src/lib/libpthread/pthread_mutex.c	Sat Jan 25 17:58:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.66 2020/01/13 18:22:56 ad Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.67 2020/01/25 17:58:28 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_mutex.c,v 1.66 2020/01/13 18:22:56 ad Exp $");
+__RCSID("$NetBSD: pthread_mutex.c,v 1.67 2020/01/25 17:58:28 ad Exp $");
 
 #include <sys/types.h>
 #include <sys/lwpctl.h>
@@ -466,7 +466,7 @@ NOINLINE static int
 pthread__mutex_unlock_slow(pthread_mutex_t *ptm)
 {
 	pthread_t self, owner, new;
-	int weown, error, deferred;
+	int weown, error;
 
 	pthread__error(EINVAL, "Invalid mutex",
 	    ptm->ptm_magic == _PT_MUTEX_MAGIC);
@@ -474,7 +474,6 @@ pthread__mutex_unlock_slow(pthread_mutex
 	self = pthread__self();
 	owner = ptm->ptm_owner;
 	weown = (MUTEX_OWNER(owner) == (uintptr_t)self);
-	deferred = (int)((uintptr_t)owner & MUTEX_DEFERRED_BIT);
 	error = 0;
 
 	if (__SIMPLELOCK_LOCKED_P(&ptm->ptm_errorcheck)) {
@@ -516,15 +515,9 @@ pthread__mutex_unlock_slow(pthread_mutex
 			pthread__mutex_wakeup(self, ptm);
 			return 0;
 		}
+		error = 0;
 	}
 
-	/*
-	 * There were no waiters, but we may have deferred waking
-	 * other threads until mutex unlock - we must wake them now.
-	 */
-	if (!deferred)
-		return error;
-
 	if (self->pt_nwaiters == 1) {
 		/*
 		 * If the calling thread is about to block, defer

Reply via email to