MFC r264388 (by davide):

Define SBT_MAX.

MFC r267896 (by davide):
Improve r264388.

MFC note.  The SBT_MAX definition already existed on stable/10, but without
the refinement from r267896.  Also, consumers of SBT_MAX were not converted,
since r264388 was not merged properly.

Reviewed by:	mav
This commit is contained in:
kib 2016-08-27 10:56:04 +00:00
parent 7767fddf9f
commit d8372db7e0
5 changed files with 13 additions and 13 deletions

View File

@ -211,7 +211,7 @@ handleevents(sbintime_t now, int fake)
} else
state->nextprof = state->nextstat;
if (now >= state->nextcallopt) {
state->nextcall = state->nextcallopt = INT64_MAX;
state->nextcall = state->nextcallopt = SBT_MAX;
callout_process(now);
}
@ -492,7 +492,7 @@ configtimer(int start)
state = DPCPU_ID_PTR(cpu, timerstate);
state->now = now;
if (!smp_started && cpu != CPU_FIRST())
state->nextevent = INT64_MAX;
state->nextevent = SBT_MAX;
else
state->nextevent = next;
if (periodic)
@ -580,8 +580,8 @@ cpu_initclocks_bsp(void)
CPU_FOREACH(cpu) {
state = DPCPU_ID_PTR(cpu, timerstate);
mtx_init(&state->et_hw_mtx, "et_hw_mtx", NULL, MTX_SPIN);
state->nextcall = INT64_MAX;
state->nextcallopt = INT64_MAX;
state->nextcall = SBT_MAX;
state->nextcallopt = SBT_MAX;
}
periodic = want_periodic;
/* Grab requested timer or the best of present. */

View File

@ -1471,7 +1471,7 @@ kqueue_scan(struct kqueue *kq, int maxevents, struct kevent_copyops *k_ops,
rsbt = tstosbt(*tsp);
if (TIMESEL(&asbt, rsbt))
asbt += tc_tick_sbt;
if (asbt <= INT64_MAX - rsbt)
if (asbt <= SBT_MAX - rsbt)
asbt += rsbt;
else
asbt = 0;

View File

@ -296,7 +296,7 @@ callout_cpu_init(struct callout_cpu *cc, int cpu)
for (i = 0; i < callwheelsize; i++)
LIST_INIT(&cc->cc_callwheel[i]);
TAILQ_INIT(&cc->cc_expireq);
cc->cc_firstevent = INT64_MAX;
cc->cc_firstevent = SBT_MAX;
for (i = 0; i < 2; i++)
cc_cce_cleanup(cc, i);
snprintf(cc->cc_ktr_event_name, sizeof(cc->cc_ktr_event_name),
@ -569,8 +569,8 @@ callout_cc_add(struct callout *c, struct callout_cpu *cc,
* Inform the eventtimers(4) subsystem there's a new callout
* that has been inserted, but only if really required.
*/
if (INT64_MAX - c->c_time < c->c_precision)
c->c_precision = INT64_MAX - c->c_time;
if (SBT_MAX - c->c_time < c->c_precision)
c->c_precision = SBT_MAX - c->c_time;
sbt = c->c_time + c->c_precision;
if (sbt < cc->cc_firstevent) {
cc->cc_firstevent = sbt;
@ -961,8 +961,8 @@ callout_reset_sbt_on(struct callout *c, sbintime_t sbt, sbintime_t precision,
to_sbt += tick_sbt;
} else
to_sbt = sbinuptime();
if (INT64_MAX - to_sbt < sbt)
to_sbt = INT64_MAX;
if (SBT_MAX - to_sbt < sbt)
to_sbt = SBT_MAX;
else
to_sbt += sbt;
pr = ((C_PRELGET(flags) < 0) ? sbt >> tc_precexp :

View File

@ -1089,7 +1089,7 @@ kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
precision >>= tc_precexp;
if (TIMESEL(&asbt, rsbt))
asbt += tc_tick_sbt;
if (asbt <= INT64_MAX - rsbt)
if (asbt <= SBT_MAX - rsbt)
asbt += rsbt;
else
asbt = -1;
@ -1626,7 +1626,7 @@ selsocket(struct socket *so, int events, struct timeval *tvp, struct thread *td)
precision >>= tc_precexp;
if (TIMESEL(&asbt, rsbt))
asbt += tc_tick_sbt;
if (asbt <= INT64_MAX - rsbt)
if (asbt <= SBT_MAX - rsbt)
asbt += rsbt;
else
asbt = -1;

View File

@ -129,7 +129,7 @@ bintime_shift(struct bintime *_bt, int _exp)
#define SBT_1MS (SBT_1S / 1000)
#define SBT_1US (SBT_1S / 1000000)
#define SBT_1NS (SBT_1S / 1000000000)
#define SBT_MAX 0x7fffffffffffffff
#define SBT_MAX 0x7fffffffffffffffLL
static __inline int
sbintime_getsec(sbintime_t _sbt)