summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-04-20 14:51:29 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-04-20 14:51:29 +0000
commit6797313c6941a44137fb3f264e4b7c6ad8490dc8 (patch)
tree3e26022b0ca80d52e8798774b75af84189510ff6 /sys
parent88b297bd996978a99126f721428b5026210e93ea (diff)
clockintr: eliminate CL_SCHEDCLOCK flag
The CL_SCHEDCLOCK flag is set when schedhz is non-zero. It's redundant. We can just check the value of schedhz directly.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_clockintr.c8
-rw-r--r--sys/sys/clockintr.h5
2 files changed, 5 insertions, 8 deletions
diff --git a/sys/kern/kern_clockintr.c b/sys/kern/kern_clockintr.c
index 94ac0a7fd65..d566495828d 100644
--- a/sys/kern/kern_clockintr.c
+++ b/sys/kern/kern_clockintr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clockintr.c,v 1.12 2023/04/20 00:24:11 cheloha Exp $ */
+/* $OpenBSD: kern_clockintr.c,v 1.13 2023/04/20 14:51:28 cheloha Exp $ */
/*
* Copyright (c) 2003 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -91,10 +91,8 @@ clockintr_init(u_int flags)
clockintr_setstatclockrate(stathz);
KASSERT(schedhz >= 0 && schedhz <= 1000000000);
- if (schedhz != 0) {
+ if (schedhz != 0)
schedclock_period = 1000000000 / schedhz;
- SET(clockintr_flags, CL_SCHEDCLOCK);
- }
SET(clockintr_flags, flags | CL_INIT);
}
@@ -181,7 +179,7 @@ clockintr_cpu_init(const struct intrclock *ic)
offset = statclock_avg / ncpus * multiplier;
clockintr_schedule(cq->cq_statclock, offset);
clockintr_advance(cq->cq_statclock, statclock_avg);
- if (ISSET(clockintr_flags, CL_SCHEDCLOCK)) {
+ if (schedhz != 0) {
offset = schedclock_period / ncpus * multiplier;
clockintr_schedule(cq->cq_schedclock, offset);
clockintr_advance(cq->cq_schedclock, schedclock_period);
diff --git a/sys/sys/clockintr.h b/sys/sys/clockintr.h
index 536bccf18c6..19fa5459a7e 100644
--- a/sys/sys/clockintr.h
+++ b/sys/sys/clockintr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: clockintr.h,v 1.6 2023/04/19 14:30:35 cheloha Exp $ */
+/* $OpenBSD: clockintr.h,v 1.7 2023/04/20 14:51:28 cheloha Exp $ */
/*
* Copyright (c) 2020-2022 Scott Cheloha <cheloha@openbsd.org>
*
@@ -113,8 +113,7 @@ struct clockintr_queue {
/* Global state flags. */
#define CL_INIT 0x00000001 /* global init done */
#define CL_STATCLOCK 0x00000002 /* statclock variables set */
-#define CL_SCHEDCLOCK 0x00000004 /* run separate schedclock */
-#define CL_STATE_MASK 0x00000007
+#define CL_STATE_MASK 0x00000003
/* Global behavior flags. */
#define CL_RNDSTAT 0x80000000 /* randomized statclock */