cam: Relax callouts precisions.

On large systems even relatively rare callouts may fire many times
per second.  This should allow them to aggregate better, since we do
not require any precision when polling for media change, etc.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2022-01-07 12:49:21 -05:00
parent ef1b9270da
commit 0e5c50bf60
5 changed files with 36 additions and 27 deletions

View File

@ -1957,9 +1957,9 @@ adaregister(struct cam_periph *periph, void *arg)
* ordered tag to a device.
*/
callout_init_mtx(&softc->sendordered_c, cam_periph_mtx(periph), 0);
callout_reset(&softc->sendordered_c,
(ada_default_timeout * hz) / ADA_ORDEREDTAG_INTERVAL,
adasendorderedtag, softc);
callout_reset_sbt(&softc->sendordered_c,
SBT_1S / ADA_ORDEREDTAG_INTERVAL * ada_default_timeout, 0,
adasendorderedtag, softc, C_PREL(1));
if (ADA_RA >= 0 && softc->flags & ADA_FLAG_CAN_RAHEAD) {
softc->state = ADA_STATE_RAHEAD;
@ -3541,10 +3541,11 @@ adasendorderedtag(void *arg)
softc->flags &= ~ADA_FLAG_WAS_OTAG;
}
}
/* Queue us up again */
callout_reset(&softc->sendordered_c,
(ada_default_timeout * hz) / ADA_ORDEREDTAG_INTERVAL,
adasendorderedtag, softc);
callout_schedule_sbt(&softc->sendordered_c,
SBT_1S / ADA_ORDEREDTAG_INTERVAL * ada_default_timeout, 0,
C_PREL(1));
}
/*

View File

@ -3043,7 +3043,7 @@ call_sim:
}
callout_reset_sbt(&dev->callout,
SBT_1MS * crs->release_timeout, 0,
SBT_1MS * crs->release_timeout, SBT_1MS,
xpt_release_devq_timeout, dev, 0);
dev->flags |= CAM_DEV_REL_TIMEOUT_PENDING;
@ -5099,8 +5099,8 @@ xpt_ch_done(void *arg)
{
callout_init(&xsoftc.boot_callout, 1);
callout_reset_sbt(&xsoftc.boot_callout, SBT_1MS * xsoftc.boot_delay, 0,
xpt_boot_delay, NULL, 0);
callout_reset_sbt(&xsoftc.boot_callout, SBT_1MS * xsoftc.boot_delay,
SBT_1MS, xpt_boot_delay, NULL, 0);
}
SYSINIT(xpt_hw_delay, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, xpt_ch_done, NULL);

View File

@ -744,9 +744,10 @@ cdregister(struct cam_periph *periph, void *arg)
callout_init_mtx(&softc->mediapoll_c, cam_periph_mtx(periph), 0);
if ((softc->flags & CD_FLAG_DISC_REMOVABLE) &&
(cgd->inq_flags & SID_AEN) == 0 &&
cd_poll_period != 0)
callout_reset(&softc->mediapoll_c, cd_poll_period * hz,
cdmediapoll, periph);
cd_poll_period != 0) {
callout_reset_sbt(&softc->mediapoll_c, cd_poll_period * SBT_1S,
0, cdmediapoll, periph, C_PREL(1));
}
xpt_schedule(periph, CAM_PRIORITY_DEV);
return(CAM_REQ_CMP);
@ -3134,9 +3135,12 @@ cdmediapoll(void *arg)
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
}
}
/* Queue us up again */
if (cd_poll_period != 0)
callout_schedule(&softc->mediapoll_c, cd_poll_period * hz);
if (cd_poll_period != 0) {
callout_schedule_sbt(&softc->mediapoll_c,
cd_poll_period * SBT_1S, 0, C_PREL(1));
}
}
/*

View File

@ -2876,9 +2876,9 @@ daregister(struct cam_periph *periph, void *arg)
* ordered tag to a device.
*/
callout_init_mtx(&softc->sendordered_c, cam_periph_mtx(periph), 0);
callout_reset(&softc->sendordered_c,
(da_default_timeout * hz) / DA_ORDEREDTAG_INTERVAL,
dasendorderedtag, periph);
callout_reset_sbt(&softc->sendordered_c,
SBT_1S / DA_ORDEREDTAG_INTERVAL * da_default_timeout, 0,
dasendorderedtag, periph, C_PREL(1));
cam_periph_unlock(periph);
/*
@ -3003,9 +3003,10 @@ daregister(struct cam_periph *periph, void *arg)
callout_init_mtx(&softc->mediapoll_c, cam_periph_mtx(periph), 0);
if ((softc->flags & DA_FLAG_PACK_REMOVABLE) &&
(cgd->inq_flags & SID_AEN) == 0 &&
da_poll_period != 0)
callout_reset(&softc->mediapoll_c, da_poll_period * hz,
damediapoll, periph);
da_poll_period != 0) {
callout_reset_sbt(&softc->mediapoll_c, da_poll_period * SBT_1S,
0, damediapoll, periph, C_PREL(1));
}
xpt_schedule(periph, CAM_PRIORITY_DEV);
@ -6035,9 +6036,12 @@ damediapoll(void *arg)
daschedule(periph);
}
}
/* Queue us up again */
if (da_poll_period != 0)
callout_schedule(&softc->mediapoll_c, da_poll_period * hz);
if (da_poll_period != 0) {
callout_schedule_sbt(&softc->mediapoll_c,
da_poll_period * SBT_1S, 0, C_PREL(1));
}
}
static void
@ -6224,9 +6228,9 @@ dasendorderedtag(void *arg)
}
/* Queue us up again */
callout_reset(&softc->sendordered_c,
(da_default_timeout * hz) / DA_ORDEREDTAG_INTERVAL,
dasendorderedtag, periph);
callout_schedule_sbt(&softc->sendordered_c,
SBT_1S / DA_ORDEREDTAG_INTERVAL * da_default_timeout, 0,
C_PREL(1));
}
/*

View File

@ -844,8 +844,8 @@ enc_daemon(void *arg)
*/
root_mount_rel(&enc->enc_rootmount);
callout_reset(&enc->status_updater, 60*hz,
enc_status_updater, enc);
callout_reset_sbt(&enc->status_updater, 60 * SBT_1S, 0,
enc_status_updater, enc, C_PREL(1));
cam_periph_sleep(enc->periph, enc->enc_daemon,
PUSER, "idle", 0);