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 linux: Make flush_workqueue a ...



details:   https://anonhg.NetBSD.org/src/rev/221826aa5052
branches:  trunk
changeset: 1028845:221826aa5052
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:11:36 2021 +0000

description:
linux: Make flush_workqueue a noop if run from the workqueue.

I think this matches Linux semantics but this is very much not clear
and not written down anywhere obvious and why is this such a
semantically incoherent mess.

diffstat:

 sys/external/bsd/common/linux/linux_work.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 27b21c88b755 -r 221826aa5052 sys/external/bsd/common/linux/linux_work.c
--- a/sys/external/bsd/common/linux/linux_work.c        Sun Dec 19 12:11:28 2021 +0000
+++ b/sys/external/bsd/common/linux/linux_work.c        Sun Dec 19 12:11:36 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_work.c,v 1.57 2021/12/19 12:11:28 riastradh Exp $        */
+/*     $NetBSD: linux_work.c,v 1.58 2021/12/19 12:11:36 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.57 2021/12/19 12:11:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.58 2021/12/19 12:11:36 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/atomic.h>
@@ -1457,6 +1457,12 @@
 {
        struct flush_work fw;
 
+       if (lwp_getspecific(workqueue_key) == wq) {
+               printf("%s: running from workqueue %s\n", __func__,
+                   wq->wq_name);
+               return;
+       }
+
        mutex_init(&fw.fw_lock, MUTEX_DEFAULT, IPL_VM);
        cv_init(&fw.fw_cv, "lxwqflsh");
        INIT_WORK(&fw.fw_work, &flush_work_cb);



Home | Main Index | Thread Index | Old Index