Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add SOBJ_SLEEPQ_NULL: means there is no TAILQ and the ca...
details: https://anonhg.NetBSD.org/src/rev/7e6cf0f2aea6
branches: trunk
changeset: 744181:7e6cf0f2aea6
user: ad <ad%NetBSD.org@localhost>
date: Sun Jan 26 19:01:56 2020 +0000
description:
Add SOBJ_SLEEPQ_NULL: means there is no TAILQ and the caller tracks the
sleeping LWPs some other way, which sleepq_*() doesn't know about.
diffstat:
sys/kern/kern_sleepq.c | 22 +++++++++++++++++-----
sys/sys/syncobj.h | 6 ++++--
2 files changed, 21 insertions(+), 7 deletions(-)
diffs (86 lines):
diff -r b877f7e118b5 -r 7e6cf0f2aea6 sys/kern/kern_sleepq.c
--- a/sys/kern/kern_sleepq.c Sun Jan 26 18:52:55 2020 +0000
+++ b/sys/kern/kern_sleepq.c Sun Jan 26 19:01:56 2020 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: kern_sleepq.c,v 1.58 2020/01/12 13:08:32 ad Exp $ */
+/* $NetBSD: kern_sleepq.c,v 1.59 2020/01/26 19:01:56 ad Exp $ */
/*-
- * Copyright (c) 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2006, 2007, 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.58 2020/01/12 13:08:32 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.59 2020/01/26 19:01:56 ad Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -114,7 +114,13 @@
KASSERT(lwp_locked(l, NULL));
- TAILQ_REMOVE(sq, l, l_sleepchain);
+ if ((l->l_syncobj->sobj_flag & SOBJ_SLEEPQ_NULL) == 0) {
+ KASSERT(sq != NULL);
+ TAILQ_REMOVE(sq, l, l_sleepchain);
+ } else {
+ KASSERT(sq == NULL);
+ }
+
l->l_syncobj = &sched_syncobj;
l->l_wchan = NULL;
l->l_sleepq = NULL;
@@ -175,6 +181,12 @@
sleepq_insert(sleepq_t *sq, lwp_t *l, syncobj_t *sobj)
{
+ if ((sobj->sobj_flag & SOBJ_SLEEPQ_NULL) != 0) {
+ KASSERT(sq == NULL);
+ return;
+ }
+ KASSERT(sq != NULL);
+
if ((sobj->sobj_flag & SOBJ_SLEEPQ_SORTED) != 0) {
lwp_t *l2;
const int pri = lwp_eprio(l);
@@ -441,7 +453,7 @@
{
KASSERT(l->l_sleepq == sq);
- if ((l->l_syncobj->sobj_flag & SOBJ_SLEEPQ_SORTED) == 0) {
+ if ((l->l_syncobj->sobj_flag & SOBJ_SLEEPQ_SORTED) == 0) {
return;
}
diff -r b877f7e118b5 -r 7e6cf0f2aea6 sys/sys/syncobj.h
--- a/sys/sys/syncobj.h Sun Jan 26 18:52:55 2020 +0000
+++ b/sys/sys/syncobj.h Sun Jan 26 19:01:56 2020 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: syncobj.h,v 1.8 2009/10/21 21:12:07 rmind Exp $ */
+/* $NetBSD: syncobj.h,v 1.9 2020/01/26 19:01:56 ad Exp $ */
/*-
- * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
+ * Copyright (c) 2007, 2008, 2020 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -54,11 +54,13 @@
#define SOBJ_SLEEPQ_SORTED 0x01
#define SOBJ_SLEEPQ_FIFO 0x02
#define SOBJ_SLEEPQ_LIFO 0x04
+#define SOBJ_SLEEPQ_NULL 0x08
extern syncobj_t sched_syncobj;
extern syncobj_t mutex_syncobj;
extern syncobj_t rw_syncobj;
extern syncobj_t sleep_syncobj;
+extern syncobj_t lwp_park_syncobj;
#endif /* defined(_KERNEL) */
Home |
Main Index |
Thread Index |
Old Index