Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/common/linux Don't wait forever to flush if...
details: https://anonhg.NetBSD.org/src/rev/9c1c7d660fe3
branches: trunk
changeset: 366349:9c1c7d660fe3
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Aug 27 15:00:27 2018 +0000
description:
Don't wait forever to flush if the worker thread has no work.
diffstat:
sys/external/bsd/common/linux/linux_work.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diffs (35 lines):
diff -r 731e70af7ece -r 9c1c7d660fe3 sys/external/bsd/common/linux/linux_work.c
--- a/sys/external/bsd/common/linux/linux_work.c Mon Aug 27 14:59:58 2018 +0000
+++ b/sys/external/bsd/common/linux/linux_work.c Mon Aug 27 15:00:27 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_work.c,v 1.18 2018/08/27 14:59:58 riastradh Exp $ */
+/* $NetBSD: linux_work.c,v 1.19 2018/08/27 15:00:27 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.18 2018/08/27 14:59:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.19 2018/08/27 15:00:27 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -704,10 +704,12 @@
uint64_t gen;
mutex_enter(&wq->wq_lock);
- gen = wq->wq_gen;
- do {
- cv_wait(&wq->wq_cv, &wq->wq_lock);
- } while (gen == wq->wq_gen);
+ if (wq->wq_current_work || !TAILQ_EMPTY(&wq->wq_queue)) {
+ gen = wq->wq_gen;
+ do {
+ cv_wait(&wq->wq_cv, &wq->wq_lock);
+ } while (gen == wq->wq_gen);
+ }
mutex_exit(&wq->wq_lock);
}
Home |
Main Index |
Thread Index |
Old Index