From 7ad3bd1293fff362f5c66ebce48387cfce4f436c Mon Sep 17 00:00:00 2001 From: imp Date: Tue, 12 Sep 2017 23:46:33 +0000 Subject: [PATCH] cam iosched: Limit the quanta default to hz if it's below 200 The cam_iosched_ticker() can't be scheduled more than once per tick. Some limiters depend on quanta matching the number of calls per second to enforce the proper limits. Limit the quanta to no faster than 1 per clock tick. This fixes some features when running in VMs where the default HZ is 100. PR: 221953 Obtained from: ElectroBSD Differential Revision: https://reviews.freebsd.org/D12337 Submitted by: Fabian Keil --- sys/cam/cam_iosched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cam/cam_iosched.c b/sys/cam/cam_iosched.c index 422096796d51..52e1092dd183 100644 --- a/sys/cam/cam_iosched.c +++ b/sys/cam/cam_iosched.c @@ -1022,7 +1022,7 @@ cam_iosched_init(struct cam_iosched_softc **iscp, struct cam_periph *periph) bioq_init(&(*iscp)->write_queue); (*iscp)->read_bias = 100; (*iscp)->current_read_bias = 100; - (*iscp)->quanta = 200; + (*iscp)->quanta = min(hz, 200); cam_iosched_iop_stats_init(*iscp, &(*iscp)->read_stats); cam_iosched_iop_stats_init(*iscp, &(*iscp)->write_stats); cam_iosched_iop_stats_init(*iscp, &(*iscp)->trim_stats);