From 570224fc49b288d7886fd96365230009e7ab35a3 Mon Sep 17 00:00:00 2001 From: cheloha Date: Thu, 20 Apr 2023 14:51:28 +0000 Subject: [PATCH] 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. --- sys/kern/kern_clockintr.c | 8 +++----- sys/sys/clockintr.h | 5 ++--- 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 * Copyright (c) 2020 Mark Kettenis @@ -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 * @@ -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 */ -- 2.20.1