Module Name:src
Committed By: martin
Date: Sun Jan 26 10:55:16 UTC 2020
Modified Files:
src/lib/libpthread [netbsd-9]: pthread.c pthread_cond.c pthread_int.h
pthread_misc.c pthread_mutex.c pthread_rwlock.c
Log Message:
Pull up following revision(s) (requested by ad in ticket #647):
lib/libpthread/pthread_rwlock.c: revision 1.37 (patch)
lib/libpthread/pthread_misc.c: revision 1.16
lib/libpthread/pthread.c: revision 1.154
lib/libpthread/pthread_int.h: revision 1.98
lib/libpthread/pthread_cond.c: revision 1.66
lib/libpthread/pthread_mutex.c: revision 1.66
Rip out some very ambitious optimisations around pthread_mutex that are
don't buy much. This stuff is hard enough to get right in the kernel let
alone userspace, and I don't trust that it's right.
To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.153.2.1 src/lib/libpthread/pthread.c
cvs rdiff -u -r1.65 -r1.65.6.1 src/lib/libpthread/pthread_cond.c
cvs rdiff -u -r1.95.2.1 -r1.95.2.2 src/lib/libpthread/pthread_int.h
cvs rdiff -u -r1.15 -r1.15.32.1 src/lib/libpthread/pthread_misc.c
cvs rdiff -u -r1.65 -r1.65.2.1 src/lib/libpthread/pthread_mutex.c
cvs rdiff -u -r1.34 -r1.34.18.1 src/lib/libpthread/pthread_rwlock.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.c
diff -u src/lib/libpthread/pthread.c:1.153 src/lib/libpthread/pthread.c:1.153.2.1
--- src/lib/libpthread/pthread.c:1.153 Tue Mar 5 01:35:52 2019
+++ src/lib/libpthread/pthread.c Sun Jan 26 10:55:16 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread.c,v 1.153 2019/03/05 01:35:52 christos Exp $ */
+/* $NetBSD: pthread.c,v 1.153.2.1 2020/01/26 10:55:16 martin Exp $ */
/*-
* Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include
-__RCSID("$NetBSD: pthread.c,v 1.153 2019/03/05 01:35:52 christos Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.153.2.1 2020/01/26 10:55:16 martin Exp $");
#define __EXPOSE_STACK 1
@@ -319,7 +319,6 @@ pthread__initthread(pthread_t t)
t->pt_havespecific = 0;
t->pt_early = NULL;
t->pt_lwpctl = &pthread__dummy_lwpctl;
- t->pt_blocking = 0;
t->pt_droplock = NULL;
memcpy(&t->pt_lockops, pthread__lock_ops, sizeof(t->pt_lockops));
@@ -1157,15 +1156,9 @@ pthread__park(pthread_t self, pthread_mu
int rv, error;
void *obj;
- /*
- * For non-interlocked release of mutexes we need a store
- * barrier before incrementing pt_blocking away from zero.
- * This is provided by pthread_mutex_unlock().
- */
self->pt_willpark = 1;
pthread_mutex_unlock(lock);
self->pt_willpark = 0;
- self->pt_blocking++;
/*
* Wait until we are awoken by a pending unpark operation,
@@ -1239,8 +1232,6 @@ pthread__park(pthread_t self, pthread_mu
pthread_mutex_unlock(lock);
}
self->pt_early = NULL;
- self->pt_blocking--;
- membar_sync();
return rv;
}
Index: src/lib/libpthread/pthread_cond.c
diff -u src/lib/libpthread/pthread_cond.c:1.65 src/lib/libpthread/pthread_cond.c:1.65.6.1
--- src/lib/libpthread/pthread_cond.c:1.65 Fri Dec 8 03:08:19 2017
+++ src/lib/libpthread/pthread_cond.c Sun Jan 26 10:55:16 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_cond.c,v 1.65 2017/12/08 03:08:19 christos Exp $ */
+/* $NetBSD: pthread_cond.c,v 1.65.6.1 2020/01/26 10:55:16 martin Exp $ */
/*-
* Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
*/
#include
-__RCSID("$NetBSD: pthread_cond.c,v 1.65 2017/12/08 03:08:19 christos Exp $");
+__RCSID("$NetBSD: pthread_cond.c,v 1.65.6.1 2020/01/26 10:55:16 martin Exp $");
#include
#include
@@ -164,7 +164,6 @@ pthread_cond_timedwait(pthread_cond_t *c
self->pt_willpark = 1;
pthread_mutex_unlock(mutex);
self->pt_willpark = 0;
- self->pt_blocking++;
do {
retval = _lwp_park(clkid, TIMER_ABSTIME,
__UNCONST(abstime), self->pt_unpark,
@@ -172,8 +171,6 @@ pthread_cond_timedwait(pthread_cond_t *c
__UNVOLATILE(&mutex->ptm_waiters));
self->pt_unpark = 0;
} while (retval == -1 && errno == ESRCH);
- self->pt_blocking--;
- membar_sync();
pthread_mutex_lock(mutex);
/*
Index: src/lib/libpthread/pthread_int.h
diff -u src/lib/libpthread/pthread_int.h:1.95.2.1 src/lib/libpthread/pthread_int.h:1.95.2.2
--- src/lib/libpthread/pthread_int.h:1.95.2.1 Wed Dec 18 20:18:20 2019
+++ src/lib/libpthread/pthread_int.h Sun Jan 26 10:55:16 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_int.h,v 1.95.2.1 2019/12/18 20:18:20 martin Exp $ */
+/* $NetBSD: pthread_int.h,v 1.95.2.2 2020/01/26 10:55:16 martin Exp $ */
/*-
* Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -131,7 +131,6 @@ struct __pthread_st {
*/
int pt_dummy1 __aligned(128);
struct lwpctl *pt_lwpctl; /* Kernel/user comms area */
- volatile int pt_blocking; /* Blocking in userspace */
volatile int pt_rwlocked; /* Handed rwloc