svn commit: r336752 - head/sys/cam

Warner Losh imp at FreeBSD.org
Thu Jul 26 22:55:52 UTC 2018


Author: imp
Date: Thu Jul 26 22:55:51 2018
New Revision: 336752
URL: https://svnweb.freebsd.org/changeset/base/336752

Log:
  For the dynamic I/O scheduler, make the TRIM stuff also count against
  read bias so we do reads in preference to TRIMs. This helps a lot when
  many trims are delivered at once from the upper layers as they tend to
  delay READs due to priority inversion in the code today.
  
  The non iosched case will be fixed when the trim comibing changes
  needed for nvme come in later this year.
  
  Sponsored by: Netflix

Modified:
  head/sys/cam/cam_iosched.c

Modified: head/sys/cam/cam_iosched.c
==============================================================================
--- head/sys/cam/cam_iosched.c	Thu Jul 26 20:03:11 2018	(r336751)
+++ head/sys/cam/cam_iosched.c	Thu Jul 26 22:55:51 2018	(r336752)
@@ -1307,7 +1307,23 @@ cam_iosched_get_trim(struct cam_iosched_softc *isc)
 
 	if (!cam_iosched_has_more_trim(isc))
 		return NULL;
-
+#ifdef CAM_IOSCHED_DYNAMIC
+	if (do_dynamic_iosched) {
+		/*
+		 * If pending read, prefer that based on current read bias
+		 * setting.
+		 */
+		if (bioq_first(&isc->bio_queue) && isc->current_read_bias) {
+			isc->current_read_bias--;
+			/* We're not limiting TRIMS, per se, just doing reads first */
+			return NULL;
+		}
+		/*
+		 * We're going to do a trim, so reset the bias.
+		 */
+		isc->current_read_bias = isc->read_bias;
+	}
+#endif
 	return cam_iosched_next_trim(isc);
 }
 


More information about the svn-src-head mailing list