summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-09-09 16:59:02 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-09-09 16:59:02 +0000
commit810046cc60a4f5b0793bfd8320a5c425d33171d6 (patch)
treec0c717bcb3e64365cbc634da72f10ac117739a60
parent54ae1e5d3255a69fd779350f1cae96b9973d4936 (diff)
clockintr_schedule: tweak logic to eliminate early return
With the introduction of clockintr_schedule_locked(), clockintr_schedule() is short enough that the early-return from the non-mutex path doesn't make the function easier to read. Move the mutex path into the else branch.
-rw-r--r--sys/kern/kern_clockintr.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/kern/kern_clockintr.c b/sys/kern/kern_clockintr.c
index d219f05c219..e6d65659c16 100644
--- a/sys/kern/kern_clockintr.c
+++ b/sys/kern/kern_clockintr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clockintr.c,v 1.43 2023/09/09 16:34:39 cheloha Exp $ */
+/* $OpenBSD: kern_clockintr.c,v 1.44 2023/09/09 16:59:01 cheloha Exp $ */
/*
* Copyright (c) 2003 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -410,12 +410,11 @@ clockintr_schedule(struct clockintr *cl, uint64_t expiration)
if (cl == &cq->cq_shadow) {
cl->cl_expiration = expiration;
SET(cl->cl_flags, CLST_SHADOW_PENDING);
- return;
+ } else {
+ mtx_enter(&cq->cq_mtx);
+ clockintr_schedule_locked(cl, expiration);
+ mtx_leave(&cq->cq_mtx);
}
-
- mtx_enter(&cq->cq_mtx);
- clockintr_schedule_locked(cl, expiration);
- mtx_leave(&cq->cq_mtx);
}
void