aboutsummaryrefslogtreecommitdiff
path: root/sys/cam
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2022-05-01 17:18:27 +0000
committerWarner Losh <imp@FreeBSD.org>2022-05-01 17:27:34 +0000
commitd592c0db8ba773c143eeea28610288f800fa651a (patch)
treea4b701a8451dccd76721a54d77914d5e543be7b8 /sys/cam
parentb65803ba5773d5fb37fa2403105db199569a5811 (diff)
downloadsrc-d592c0db8ba773c143eeea28610288f800fa651a.tar.gz
src-d592c0db8ba773c143eeea28610288f800fa651a.zip
cam: add hw.cam.iosched.read_bias
Allow a global setting for the read_bias for the dynamic io scheduler. This allows global policy to be set, in addition to the existing per-drive policy. kern.cam.iosched.read_bias is a new tunable. Sponsored by: Netflix Reviewed by: chs Differential Revision: https://reviews.freebsd.org/D34365
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/cam_iosched.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/cam/cam_iosched.c b/sys/cam/cam_iosched.c
index 21a948b69c69..c1e11419856b 100644
--- a/sys/cam/cam_iosched.c
+++ b/sys/cam/cam_iosched.c
@@ -139,6 +139,15 @@ SYSCTL_INT(_kern_cam_iosched, OID_AUTO, buckets, CTLFLAG_RD,
&lat_buckets, LAT_BUCKETS,
"Total number of latency buckets published");
+/*
+ * Read bias: how many reads do we favor before scheduling a write
+ * when we have a choice.
+ */
+static int default_read_bias = 0;
+SYSCTL_INT(_kern_cam_iosched, OID_AUTO, read_bias, CTLFLAG_RWTUN,
+ &default_read_bias, 0,
+ "Default read bias for new devices.");
+
struct iop_stats;
struct cam_iosched_softc;
@@ -1149,7 +1158,7 @@ cam_iosched_init(struct cam_iosched_softc **iscp, struct cam_periph *periph)
#ifdef CAM_IOSCHED_DYNAMIC
if (do_dynamic_iosched) {
bioq_init(&(*iscp)->write_queue);
- (*iscp)->read_bias = 0;
+ (*iscp)->read_bias = default_read_bias;
(*iscp)->current_read_bias = 0;
(*iscp)->quanta = min(hz, 200);
cam_iosched_iop_stats_init(*iscp, &(*iscp)->read_stats);
@@ -1234,7 +1243,7 @@ void cam_iosched_sysctl_init(struct cam_iosched_softc *isc,
SYSCTL_ADD_INT(ctx, n,
OID_AUTO, "read_bias", CTLFLAG_RW,
- &isc->read_bias, 0,
+ &isc->read_bias, default_read_bias,
"How biased towards read should we be independent of limits");
SYSCTL_ADD_PROC(ctx, n,