From 035ec48e5546fabe178fd7015cc268843df24821 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 7 Jul 2016 20:31:35 +0000 Subject: [PATCH] Tidy up loose ends from Netflix I/O sched rename to dynamic I/O sched. Rename kern.cam.do_netflix_iosched sysctl to kern.cam.do_dynamic_iosched. Approved by: re (kib@) --- sys/cam/cam_iosched.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/sys/cam/cam_iosched.c b/sys/cam/cam_iosched.c index d098ae54a56..b24f4ca6df4 100644 --- a/sys/cam/cam_iosched.c +++ b/sys/cam/cam_iosched.c @@ -59,15 +59,19 @@ static MALLOC_DEFINE(M_CAMSCHED, "CAM I/O Scheduler", * Default I/O scheduler for FreeBSD. This implementation is just a thin-vineer * over the bioq_* interface, with notions of separate calls for normal I/O and * for trims. + * + * When CAM_IOSCHED_DYNAMIC is defined, the scheduler is enhanced to dynamically + * steer the rate of one type of traffic to help other types of traffic (eg + * limit writes when read latency deteriorates on SSDs). */ #ifdef CAM_IOSCHED_DYNAMIC -static int do_netflix_iosched = 1; -TUNABLE_INT("kern.cam.do_netflix_iosched", &do_netflix_iosched); -SYSCTL_INT(_kern_cam, OID_AUTO, do_netflix_iosched, CTLFLAG_RD, - &do_netflix_iosched, 1, - "Enable Netflix I/O scheduler optimizations."); +static int do_dynamic_iosched = 1; +TUNABLE_INT("kern.cam.do_dynamic_iosched", &do_dynamic_iosched); +SYSCTL_INT(_kern_cam, OID_AUTO, do_dynamic_iosched, CTLFLAG_RD, + &do_dynamic_iosched, 1, + "Enable Dynamic I/O scheduler optimizations."); static int alpha_bits = 9; TUNABLE_INT("kern.cam.iosched_alpha_bits", &alpha_bits); @@ -640,7 +644,7 @@ static inline int cam_iosched_has_io(struct cam_iosched_softc *isc) { #ifdef CAM_IOSCHED_DYNAMIC - if (do_netflix_iosched) { + if (do_dynamic_iosched) { struct bio *rbp = bioq_first(&isc->bio_queue); struct bio *wbp = bioq_first(&isc->write_queue); int can_write = wbp != NULL && @@ -954,7 +958,7 @@ cam_iosched_init(struct cam_iosched_softc **iscp, struct cam_periph *periph) bioq_init(&(*iscp)->bio_queue); bioq_init(&(*iscp)->trim_queue); #ifdef CAM_IOSCHED_DYNAMIC - if (do_netflix_iosched) { + if (do_dynamic_iosched) { bioq_init(&(*iscp)->write_queue); (*iscp)->read_bias = 100; (*iscp)->current_read_bias = 100; @@ -1019,7 +1023,7 @@ void cam_iosched_sysctl_init(struct cam_iosched_softc *isc, "Sort IO queue to try and optimise disk access patterns"); #ifdef CAM_IOSCHED_DYNAMIC - if (!do_netflix_iosched) + if (!do_dynamic_iosched) return; isc->sysctl_tree = SYSCTL_ADD_NODE(&isc->sysctl_ctx, @@ -1061,7 +1065,7 @@ cam_iosched_flush(struct cam_iosched_softc *isc, struct devstat *stp, int err) bioq_flush(&isc->bio_queue, stp, err); bioq_flush(&isc->trim_queue, stp, err); #ifdef CAM_IOSCHED_DYNAMIC - if (do_netflix_iosched) + if (do_dynamic_iosched) bioq_flush(&isc->write_queue, stp, err); #endif } @@ -1206,7 +1210,7 @@ cam_iosched_next_bio(struct cam_iosched_softc *isc) * See if we have any pending writes, and room in the queue for them, * and if so, those are next. */ - if (do_netflix_iosched) { + if (do_dynamic_iosched) { if ((bp = cam_iosched_get_write(isc)) != NULL) return bp; } @@ -1223,7 +1227,7 @@ cam_iosched_next_bio(struct cam_iosched_softc *isc) * For the netflix scheduler, bio_queue is only for reads, so enforce * the limits here. Enforce only for reads. */ - if (do_netflix_iosched) { + if (do_dynamic_iosched) { if (bp->bio_cmd == BIO_READ && cam_iosched_limiter_iop(&isc->read_stats, bp) != 0) return NULL; @@ -1231,7 +1235,7 @@ cam_iosched_next_bio(struct cam_iosched_softc *isc) #endif bioq_remove(&isc->bio_queue, bp); #ifdef CAM_IOSCHED_DYNAMIC - if (do_netflix_iosched) { + if (do_dynamic_iosched) { if (bp->bio_cmd == BIO_READ) { isc->read_stats.queued--; isc->read_stats.total++; @@ -1268,7 +1272,7 @@ cam_iosched_queue_work(struct cam_iosched_softc *isc, struct bio *bp) #endif } #ifdef CAM_IOSCHED_DYNAMIC - else if (do_netflix_iosched && + else if (do_dynamic_iosched && (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_FLUSH)) { if (cam_iosched_sort_queue(isc)) bioq_disksort(&isc->write_queue, bp); @@ -1332,7 +1336,7 @@ cam_iosched_bio_complete(struct cam_iosched_softc *isc, struct bio *bp, { int retval = 0; #ifdef CAM_IOSCHED_DYNAMIC - if (!do_netflix_iosched) + if (!do_dynamic_iosched) return retval; if (iosched_debug > 10)