Remove kernel lock here since msleep() with PCATCH no longer requires it.
authorclaudio <claudio@openbsd.org>
Wed, 9 Nov 2022 22:25:36 +0000 (22:25 +0000)
committerclaudio <claudio@openbsd.org>
Wed, 9 Nov 2022 22:25:36 +0000 (22:25 +0000)
OK mpi@

sys/kern/kern_event.c

index 159531d..388691e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: kern_event.c,v 1.193 2022/08/14 01:58:27 jsg Exp $    */
+/*     $OpenBSD: kern_event.c,v 1.194 2022/11/09 22:25:36 claudio Exp $        */
 
 /*-
  * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -1287,14 +1287,10 @@ retry:
        error = 0;
        reinserted = 0;
 
-       /* msleep() with PCATCH requires kernel lock. */
-       KERNEL_LOCK();
-
        mtx_enter(&kq->kq_lock);
 
        if (kq->kq_state & KQ_DYING) {
                mtx_leave(&kq->kq_lock);
-               KERNEL_UNLOCK();
                error = EBADF;
                goto done;
        }
@@ -1307,14 +1303,12 @@ retry:
                if ((tsp != NULL && !timespecisset(tsp)) ||
                    scan->kqs_nevent != 0) {
                        mtx_leave(&kq->kq_lock);
-                       KERNEL_UNLOCK();
                        error = 0;
                        goto done;
                }
                kq->kq_state |= KQ_SLEEP;
                error = kqueue_sleep(kq, tsp);
                /* kqueue_sleep() has released kq_lock. */
-               KERNEL_UNLOCK();
                if (error == 0 || error == EWOULDBLOCK)
                        goto retry;
                /* don't restart after signals... */
@@ -1323,9 +1317,6 @@ retry:
                goto done;
        }
 
-       /* The actual scan does not sleep on kq, so unlock the kernel. */
-       KERNEL_UNLOCK();
-
        /*
         * Put the end marker in the queue to limit the scan to the events
         * that are currently active.  This prevents events from being