Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys kpause(): is only awoken via timeout or signal, so use S...
details: https://anonhg.NetBSD.org/src/rev/d30d7015af0d
branches: trunk
changeset: 969587:d30d7015af0d
user: ad <ad%NetBSD.org@localhost>
date: Sun Feb 23 16:27:09 2020 +0000
description:
kpause(): is only awoken via timeout or signal, so use SOBJ_SLEEPQ_NULL like
_lwp_park() does, and dispense with the hashed sleepq & lock.
diffstat:
sys/kern/kern_synch.c | 20 +++++++++++++-------
sys/sys/syncobj.h | 3 ++-
2 files changed, 15 insertions(+), 8 deletions(-)
diffs (72 lines):
diff -r 1d0e5821fbe3 -r d30d7015af0d sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c Sun Feb 23 16:04:58 2020 +0000
+++ b/sys/kern/kern_synch.c Sun Feb 23 16:27:09 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_synch.c,v 1.341 2020/02/23 15:46:41 ad Exp $ */
+/* $NetBSD: kern_synch.c,v 1.342 2020/02/23 16:27:09 ad Exp $ */
/*-
* Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009, 2019, 2020
@@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.341 2020/02/23 15:46:41 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.342 2020/02/23 16:27:09 ad Exp $");
#include "opt_kstack.h"
#include "opt_dtrace.h"
@@ -122,6 +122,14 @@
.sobj_owner = syncobj_noowner,
};
+syncobj_t kpause_syncobj = {
+ .sobj_flag = SOBJ_SLEEPQ_NULL,
+ .sobj_unsleep = sleepq_unsleep,
+ .sobj_changepri = sleepq_changepri,
+ .sobj_lendpri = sleepq_lendpri,
+ .sobj_owner = syncobj_noowner,
+};
+
/* "Lightning bolt": once a second sleep address. */
kcondvar_t lbolt __cacheline_aligned;
@@ -258,8 +266,6 @@
kpause(const char *wmesg, bool intr, int timo, kmutex_t *mtx)
{
struct lwp *l = curlwp;
- kmutex_t *mp;
- sleepq_t *sq;
int error;
KASSERT(!(timo == 0 && intr == false));
@@ -270,9 +276,9 @@
if (mtx != NULL)
mutex_exit(mtx);
l->l_kpriority = true;
- sq = sleeptab_lookup(&sleeptab, l, &mp);
- sleepq_enter(sq, l, mp);
- sleepq_enqueue(sq, l, wmesg, &sleep_syncobj);
+ lwp_lock(l);
+ KERNEL_UNLOCK_ALL(NULL, &l->l_biglocks);
+ sleepq_enqueue(NULL, l, wmesg, &kpause_syncobj);
error = sleepq_block(timo, intr);
if (mtx != NULL)
mutex_enter(mtx);
diff -r 1d0e5821fbe3 -r d30d7015af0d sys/sys/syncobj.h
--- a/sys/sys/syncobj.h Sun Feb 23 16:04:58 2020 +0000
+++ b/sys/sys/syncobj.h Sun Feb 23 16:27:09 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syncobj.h,v 1.10 2020/02/15 17:09:24 ad Exp $ */
+/* $NetBSD: syncobj.h,v 1.11 2020/02/23 16:27:09 ad Exp $ */
/*-
* Copyright (c) 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -59,6 +59,7 @@
extern syncobj_t cv_syncobj;
extern syncobj_t lwp_park_syncobj;
extern syncobj_t mutex_syncobj;
+extern syncobj_t kpause_syncobj;
extern syncobj_t rw_syncobj;
extern syncobj_t sched_syncobj;
extern syncobj_t select_syncobj;
Home |
Main Index |
Thread Index |
Old Index