Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jul 2018 22:55:52 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336752 - head/sys/cam
Message-ID:  <201807262255.w6QMtqak013655@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807262255.w6QMtqak013655>