git: d592c0db8ba7 - main - cam: add hw.cam.iosched.read_bias
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 01 May 2022 17:27:39 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=d592c0db8ba773c143eeea28610288f800fa651a
commit d592c0db8ba773c143eeea28610288f800fa651a
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-05-01 17:18:27 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-05-01 17:27:34 +0000
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
---
sys/cam/cam_iosched.c | 13 +++++++++++--
1 file 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,