From owner-svn-src-all@freebsd.org Fri Sep 22 02:36:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52D8FE0A965; Fri, 22 Sep 2017 02:36:33 +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 mx1.freebsd.org (Postfix) with ESMTPS id 20A5475373; Fri, 22 Sep 2017 02:36:33 +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 v8M2aWGf081688; Fri, 22 Sep 2017 02:36:32 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8M2aWUN081687; Fri, 22 Sep 2017 02:36:32 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201709220236.v8M2aWUN081687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 22 Sep 2017 02:36:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323893 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 323893 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Sep 2017 02:36:33 -0000 Author: imp Date: Fri Sep 22 02:36:32 2017 New Revision: 323893 URL: https://svnweb.freebsd.org/changeset/base/323893 Log: cam iosched: Enforce iop limits below the quanta value Previously the iops limiter would always allow at least quanta ios per second as cam_iosched_iops_tick() never set ios->l_value1 below 1. Submitted by: Fabian Keil Obtained from: ElectroBSD PR: 221974 Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Fri Sep 22 00:34:46 2017 (r323892) +++ head/sys/cam/cam_iosched.c Fri Sep 22 02:36:32 2017 (r323893) @@ -415,6 +415,7 @@ cam_iosched_iops_init(struct iop_stats *ios) ios->l_value1 = ios->current / ios->softc->quanta; if (ios->l_value1 <= 0) ios->l_value1 = 1; + ios->l_value2 = 0; return 0; } @@ -423,9 +424,18 @@ static int cam_iosched_iops_tick(struct iop_stats *ios) { + if ((ios->softc->total_ticks % ios->softc->quanta) == 0) + ios->l_value2 = 0; + ios->l_value1 = (int)((ios->current * (uint64_t)ios->softc->this_frac) >> 16); - if (ios->l_value1 <= 0) + /* + * Allow at least one IO per tick until all + * the IOs for this interval have been spent. + */ + if (ios->l_value1 <= 0 && ios->l_value2 < ios->current) { ios->l_value1 = 1; + ios->l_value2++; + } return 0; }