From owner-svn-src-head@freebsd.org Thu Jul 26 22:55:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C414F105B246; Thu, 26 Jul 2018 22:55:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6B3787B30B; Thu, 26 Jul 2018 22:55:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 464727B31; Thu, 26 Jul 2018 22:55:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6QMtqbk013656; Thu, 26 Jul 2018 22:55:52 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6QMtqak013655; Thu, 26 Jul 2018 22:55:52 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807262255.w6QMtqak013655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 26 Jul 2018 22:55:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336752 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 336752 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jul 2018 22:55:52 -0000 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); }