This commit is contained in:
purplerain 2023-07-06 21:55:14 +00:00
parent f1b2576417
commit 2a351e0cdc
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
347 changed files with 9596 additions and 5486 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_clockintr.c,v 1.25 2023/06/22 16:23:50 cheloha Exp $ */
/* $OpenBSD: kern_clockintr.c,v 1.27 2023/07/02 19:02:27 cheloha Exp $ */
/*
* Copyright (c) 2003 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@ -29,8 +29,6 @@
#include <sys/sysctl.h>
#include <sys/time.h>
#ifdef __HAVE_CLOCKINTR
/*
* Protection for global variables in this file:
*
@ -107,7 +105,7 @@ clockintr_init(u_int flags)
void
clockintr_cpu_init(const struct intrclock *ic)
{
uint64_t multiplier = 0, offset;
uint64_t multiplier = 0;
struct cpu_info *ci = curcpu();
struct clockintr_queue *cq = &ci->ci_queue;
int reset_cq_intrclock = 0;
@ -170,21 +168,28 @@ clockintr_cpu_init(const struct intrclock *ic)
clockintr_advance(cq->cq_hardclock, hardclock_period);
} else {
if (cq->cq_hardclock->cl_expiration == 0) {
offset = hardclock_period / ncpus * multiplier;
cq->cq_hardclock->cl_expiration = offset;
clockintr_stagger(cq->cq_hardclock, hardclock_period,
multiplier, MAXCPUS);
}
clockintr_advance(cq->cq_hardclock, hardclock_period);
}
/*
* We can always advance the statclock and schedclock.
* There is no reason to stagger a randomized statclock.
*/
offset = statclock_avg / ncpus * multiplier;
clockintr_schedule(cq->cq_statclock, offset);
if (!ISSET(clockintr_flags, CL_RNDSTAT)) {
if (cq->cq_statclock->cl_expiration == 0) {
clockintr_stagger(cq->cq_statclock, statclock_avg,
multiplier, MAXCPUS);
}
}
clockintr_advance(cq->cq_statclock, statclock_avg);
if (schedhz != 0) {
offset = schedclock_period / ncpus * multiplier;
clockintr_schedule(cq->cq_schedclock, offset);
if (cq->cq_schedclock->cl_expiration == 0) {
clockintr_stagger(cq->cq_schedclock, schedclock_period,
multiplier, MAXCPUS);
}
clockintr_advance(cq->cq_schedclock, schedclock_period);
}
@ -766,4 +771,3 @@ db_show_clockintr(const struct clockintr *cl, const char *state, u_int cpu)
}
#endif /* DDB */
#endif /*__HAVE_CLOCKINTR */