hardclock_ticks -> getticks()

This commit is contained in:
maxv 2020-04-13 15:54:45 +00:00
parent d86ca2518a
commit 983fd9ccfe
9 changed files with 43 additions and 43 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_condvar.c,v 1.45 2020/04/10 17:16:21 ad Exp $ */
/* $NetBSD: kern_condvar.c,v 1.46 2020/04/13 15:54:45 maxv Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008, 2019, 2020 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.45 2020/04/10 17:16:21 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.46 2020/04/13 15:54:45 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -340,13 +340,13 @@ cv_timedwaitbt(kcondvar_t *cv, kmutex_t *mtx, struct bintime *bt,
KASSERTMSG(epsilon != NULL, "specify maximum requested delay");
/*
* hardclock_ticks is technically int, but nothing special
* getticks() is technically int, but nothing special
* happens instead of overflow, so we assume two's-complement
* wraparound and just treat it as unsigned.
*/
start = hardclock_ticks;
start = getticks();
error = cv_timedwait(cv, mtx, bintime2timo(bt));
end = hardclock_ticks;
end = getticks();
slept = timo2bintime(end - start);
/* bt := bt - slept */
@ -383,13 +383,13 @@ cv_timedwaitbt_sig(kcondvar_t *cv, kmutex_t *mtx, struct bintime *bt,
KASSERTMSG(epsilon != NULL, "specify maximum requested delay");
/*
* hardclock_ticks is technically int, but nothing special
* getticks() is technically int, but nothing special
* happens instead of overflow, so we assume two's-complement
* wraparound and just treat it as unsigned.
*/
start = hardclock_ticks;
start = getticks();
error = cv_timedwait_sig(cv, mtx, bintime2timo(bt));
end = hardclock_ticks;
end = getticks();
slept = timo2bintime(end - start);
/* bt := bt - slept */

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_runq.c,v 1.65 2020/04/04 20:17:58 ad Exp $ */
/* $NetBSD: kern_runq.c,v 1.66 2020/04/13 15:54:45 maxv Exp $ */
/*-
* Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_runq.c,v 1.65 2020/04/04 20:17:58 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_runq.c,v 1.66 2020/04/13 15:54:45 maxv Exp $");
#include "opt_dtrace.h"
@ -417,7 +417,7 @@ lwp_cache_hot(const struct lwp *l)
if (__predict_false(l->l_slptime != 0 || l->l_rticks == 0))
return false;
return (hardclock_ticks - l->l_rticks < mstohz(cacheht_time));
return (getticks() - l->l_rticks < mstohz(cacheht_time));
}
/*
@ -840,10 +840,10 @@ sched_idle(void)
* XXX Should probably look at 2nd class CPUs first, but they will
* shed jobs via preempt() anyway.
*/
if (spc->spc_nextskim > hardclock_ticks) {
if (spc->spc_nextskim > getticks()) {
return;
}
spc->spc_nextskim = hardclock_ticks + mstohz(skim_interval);
spc->spc_nextskim = getticks() + mstohz(skim_interval);
/* In the outer loop scroll through all CPU packages, starting here. */
first = ci->ci_package1st;
@ -1057,7 +1057,7 @@ sched_nextlwp(void)
/* Update the last run time on switch */
l = curlwp;
l->l_rticksum += (hardclock_ticks - l->l_rticks);
l->l_rticksum += (getticks() - l->l_rticks);
/* Return to idle LWP if there is a migrating thread */
spc = &ci->ci_schedstate;
@ -1075,7 +1075,7 @@ sched_nextlwp(void)
KASSERT(l != NULL);
sched_oncpu(l);
l->l_rticks = hardclock_ticks;
l->l_rticks = getticks();
return l;
}
@ -1204,7 +1204,7 @@ sched_print_runqueue(void (*pr)(const char *, ...))
l->l_flag, l->l_stat == LSRUN ? "RQ" :
(l->l_stat == LSSLEEP ? "SQ" : "-"),
l, ci->ci_index, (tci ? tci->ci_index : -1),
(u_int)(hardclock_ticks - l->l_rticks));
(u_int)(getticks() - l->l_rticks));
}
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_sleepq.c,v 1.64 2020/04/10 17:16:21 ad Exp $ */
/* $NetBSD: kern_sleepq.c,v 1.65 2020/04/13 15:54:45 maxv Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.64 2020/04/10 17:16:21 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.65 2020/04/13 15:54:45 maxv Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -151,7 +151,7 @@ sleepq_remove(sleepq_t *sq, lwp_t *l)
}
/* Update sleep time delta, call the wake-up handler of scheduler */
l->l_slpticksum += (hardclock_ticks - l->l_slpticks);
l->l_slpticksum += (getticks() - l->l_slpticks);
sched_wakeup(l);
/* Look for a CPU to wake up */
@ -228,7 +228,7 @@ sleepq_enqueue(sleepq_t *sq, wchan_t wchan, const char *wmesg, syncobj_t *sobj)
sleepq_insert(sq, l, sobj);
/* Save the time when thread has slept */
l->l_slpticks = hardclock_ticks;
l->l_slpticks = getticks();
sched_slept(l);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_timeout.c,v 1.59 2020/03/21 02:32:37 ad Exp $ */
/* $NetBSD: kern_timeout.c,v 1.60 2020/04/13 15:54:45 maxv Exp $ */
/*-
* Copyright (c) 2003, 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.59 2020/03/21 02:32:37 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.60 2020/04/13 15:54:45 maxv Exp $");
/*
* Timeouts are kept in a hierarchical timing wheel. The c_time is the
@ -839,7 +839,7 @@ db_show_callout(db_expr_t addr, bool haddr, db_expr_t count, const char *modif)
int b;
#ifndef CRASH
db_printf("hardclock_ticks now: %d\n", hardclock_ticks);
db_printf("hardclock_ticks now: %d\n", getticks());
#endif
db_printf(" ticks wheel arg func\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: sched_m2.c,v 1.37 2019/12/06 18:33:19 ad Exp $ */
/* $NetBSD: sched_m2.c,v 1.38 2020/04/13 15:54:45 maxv Exp $ */
/*
* Copyright (c) 2007, 2008 Mindaugas Rasiukevicius <rmind at NetBSD org>
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sched_m2.c,v 1.37 2019/12/06 18:33:19 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: sched_m2.c,v 1.38 2020/04/13 15:54:45 maxv Exp $");
#include <sys/param.h>
@ -255,7 +255,7 @@ sched_pstats_hook(struct lwp *l, int batch)
/* If thread was not ran a second or more - set a high priority */
if (l->l_stat == LSRUN) {
if (l->l_rticks && (hardclock_ticks - l->l_rticks >= hz))
if (l->l_rticks && (getticks() - l->l_rticks >= hz))
prio = high_pri[prio];
/* Re-enqueue the thread if priority has changed */
if (prio != l->l_priority)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_mount.c,v 1.76 2020/04/10 22:34:36 ad Exp $ */
/* $NetBSD: vfs_mount.c,v 1.77 2020/04/13 15:54:45 maxv Exp $ */
/*-
* Copyright (c) 1997-2020 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.76 2020/04/10 22:34:36 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.77 2020/04/13 15:54:45 maxv Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -520,9 +520,9 @@ struct ctldebug debug1 = { "busyprt", &busyprt };
static vnode_t *
vflushnext(struct vnode_iterator *marker, int *when)
{
if (hardclock_ticks > *when) {
if (getticks() > *when) {
yield();
*when = hardclock_ticks + hz / 10;
*when = getticks() + hz / 10;
}
return vfs_vnode_iterator_next1(marker, NULL, NULL, true);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_vnode.c,v 1.118 2020/04/04 20:54:42 ad Exp $ */
/* $NetBSD: vfs_vnode.c,v 1.119 2020/04/13 15:54:45 maxv Exp $ */
/*-
* Copyright (c) 1997-2011, 2019, 2020 The NetBSD Foundation, Inc.
@ -155,7 +155,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.118 2020/04/04 20:54:42 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.119 2020/04/13 15:54:45 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_pax.h"
@ -483,7 +483,7 @@ lru_requeue(vnode_t *vp, vnodelst_t *listhd)
*/
vip = VNODE_TO_VIMPL(vp);
if (listhd == vip->vi_lrulisthd &&
(hardclock_ticks - vip->vi_lrulisttm) < hz) {
(getticks() - vip->vi_lrulisttm) < hz) {
return;
}
@ -494,7 +494,7 @@ lru_requeue(vnode_t *vp, vnodelst_t *listhd)
else
d++;
vip->vi_lrulisthd = listhd;
vip->vi_lrulisttm = hardclock_ticks;
vip->vi_lrulisttm = getticks();
if (vip->vi_lrulisthd != NULL)
TAILQ_INSERT_TAIL(vip->vi_lrulisthd, vip, vi_lrulist);
else
@ -540,7 +540,7 @@ vrele_flush(struct mount *mp)
KASSERT(vip->vi_lrulisthd == &lru_list[LRU_VRELE]);
TAILQ_REMOVE(vip->vi_lrulisthd, vip, vi_lrulist);
vip->vi_lrulisthd = &lru_list[LRU_HOLD];
vip->vi_lrulisttm = hardclock_ticks;
vip->vi_lrulisttm = getticks();
TAILQ_INSERT_TAIL(vip->vi_lrulisthd, vip, vi_lrulist);
mutex_exit(&vdrain_lock);
@ -622,7 +622,7 @@ vdrain_vrele(vnode_t *vp)
KASSERT(vip->vi_lrulisthd == &lru_list[LRU_VRELE]);
TAILQ_REMOVE(vip->vi_lrulisthd, vip, vi_lrulist);
vip->vi_lrulisthd = &lru_list[LRU_HOLD];
vip->vi_lrulisttm = hardclock_ticks;
vip->vi_lrulisttm = getticks();
TAILQ_INSERT_TAIL(vip->vi_lrulisthd, vip, vi_lrulist);
vdrain_retry = true;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_usrreq.c,v 1.225 2019/08/06 15:48:18 riastradh Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.226 2020/04/13 15:54:45 maxv Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -99,7 +99,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.225 2019/08/06 15:48:18 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.226 2020/04/13 15:54:45 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -256,7 +256,7 @@ tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti)
}
ti->tcpi_rto = tp->t_rxtcur * tick;
ti->tcpi_last_data_recv = (long)(hardclock_ticks -
ti->tcpi_last_data_recv = (long)(getticks() -
(int)tp->t_rcvtime) * tick;
ti->tcpi_rtt = ((u_int64_t)tp->t_srtt * tick) >> TCP_RTT_SHIFT;
ti->tcpi_rttvar = ((u_int64_t)tp->t_rttvar * tick) >> TCP_RTTVAR_SHIFT;

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_pdaemon.c,v 1.125 2020/02/23 15:46:43 ad Exp $ */
/* $NetBSD: uvm_pdaemon.c,v 1.126 2020/04/13 15:54:45 maxv Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.125 2020/02/23 15:46:43 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.126 2020/04/13 15:54:45 maxv Exp $");
#include "opt_uvmhist.h"
#include "opt_readahead.h"
@ -998,9 +998,9 @@ uvmpd_pool_drain_thread(void *arg)
*/
mutex_enter(&uvmpd_lock);
if (!uvmpd_pool_drain_run) {
lastslept = hardclock_ticks;
lastslept = getticks();
cv_wait(&uvmpd_pool_drain_cv, &uvmpd_lock);
if (hardclock_ticks != lastslept) {
if (getticks() != lastslept) {
cycled = false;
firstpool = NULL;
}