cam iosched: Schedule cam_iosched_ticker() quanta times per second

Previously callout_reset() was called with a "ticks" value that was
off by one.  As a result cam_iosched_ticker() was called a bit too
frequently: On systems with hz=1000 a quanta value of 200 resulted in
~250 calls and a value of 100 in ~111 calls.

For the "queue_depth" and "bandwidth" limiters the difference doesn't
matter but the "iops" limiter depends on the scheduling to enforce the
correct maximum.

PR: 221956
Obtained from: ElectroBSD
Submitted by: Fabian Keil
Differential Revision: https://reviews.freebsd.org/D12350
This commit is contained in:
Warner Losh 2017-09-20 21:25:56 +00:00
parent 2d22619adc
commit 3028dd8dd5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323831

View File

@ -533,7 +533,7 @@ cam_iosched_ticker(void *arg)
sbintime_t now, delta;
int pending;
callout_reset(&isc->ticker, hz / isc->quanta - 1, cam_iosched_ticker, isc);
callout_reset(&isc->ticker, hz / isc->quanta, cam_iosched_ticker, isc);
now = sbinuptime();
delta = now - isc->last_time;
@ -798,7 +798,7 @@ cam_iosched_limiter_sysctl(SYSCTL_HANDLER_ARGS)
return error;
}
/* Note: disk load averate requires ticker to be always running */
callout_reset(&isc->ticker, hz / isc->quanta - 1, cam_iosched_ticker, isc);
callout_reset(&isc->ticker, hz / isc->quanta, cam_iosched_ticker, isc);
isc->flags |= CAM_IOSCHED_FLAG_CALLOUT_ACTIVE;
cam_periph_unlock(isc->periph);
@ -1055,7 +1055,7 @@ cam_iosched_init(struct cam_iosched_softc **iscp, struct cam_periph *periph)
callout_init_mtx(&(*iscp)->ticker, cam_periph_mtx(periph), 0);
(*iscp)->periph = periph;
cam_iosched_cl_init(&(*iscp)->cl, *iscp);
callout_reset(&(*iscp)->ticker, hz / (*iscp)->quanta - 1, cam_iosched_ticker, *iscp);
callout_reset(&(*iscp)->ticker, hz / (*iscp)->quanta, cam_iosched_ticker, *iscp);
(*iscp)->flags |= CAM_IOSCHED_FLAG_CALLOUT_ACTIVE;
}
#endif