Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Sep 2017 21:25:56 +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: r323831 - head/sys/cam
Message-ID:  <201709202125.v8KLPuZG057884@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Wed Sep 20 21:25:56 2017
New Revision: 323831
URL: https://svnweb.freebsd.org/changeset/base/323831

Log:
  cam iosched: Schedule cam_iosched_ticker() quanta times per second
  
  Previously callout_reset() was called with a "ticks" value that was
  off by one.  As a result cam_iosched_ticker() was called a bit too
  frequently: On systems with hz=1000 a quanta value of 200 resulted in
  ~250 calls and a value of 100 in ~111 calls.
  
  For the "queue_depth" and "bandwidth" limiters the difference doesn't
  matter but the "iops" limiter depends on the scheduling to enforce the
  correct maximum.
  
  PR: 221956
  Obtained from: ElectroBSD
  Submitted by: Fabian Keil
  Differential Revision: https://reviews.freebsd.org/D12350

Modified:
  head/sys/cam/cam_iosched.c

Modified: head/sys/cam/cam_iosched.c
==============================================================================
--- head/sys/cam/cam_iosched.c	Wed Sep 20 21:22:20 2017	(r323830)
+++ head/sys/cam/cam_iosched.c	Wed Sep 20 21:25:56 2017	(r323831)
@@ -533,7 +533,7 @@ cam_iosched_ticker(void *arg)
 	sbintime_t now, delta;
 	int pending;
 
-	callout_reset(&isc->ticker, hz / isc->quanta - 1, cam_iosched_ticker, isc);
+	callout_reset(&isc->ticker, hz / isc->quanta, cam_iosched_ticker, isc);
 
 	now = sbinuptime();
 	delta = now - isc->last_time;
@@ -798,7 +798,7 @@ cam_iosched_limiter_sysctl(SYSCTL_HANDLER_ARGS)
 			return error;
 		}
 		/* Note: disk load averate requires ticker to be always running */
-		callout_reset(&isc->ticker, hz / isc->quanta - 1, cam_iosched_ticker, isc);
+		callout_reset(&isc->ticker, hz / isc->quanta, cam_iosched_ticker, isc);
 		isc->flags |= CAM_IOSCHED_FLAG_CALLOUT_ACTIVE;
 
 		cam_periph_unlock(isc->periph);
@@ -1055,7 +1055,7 @@ cam_iosched_init(struct cam_iosched_softc **iscp, stru
 		callout_init_mtx(&(*iscp)->ticker, cam_periph_mtx(periph), 0);
 		(*iscp)->periph = periph;
 		cam_iosched_cl_init(&(*iscp)->cl, *iscp);
-		callout_reset(&(*iscp)->ticker, hz / (*iscp)->quanta - 1, cam_iosched_ticker, *iscp);
+		callout_reset(&(*iscp)->ticker, hz / (*iscp)->quanta, cam_iosched_ticker, *iscp);
 		(*iscp)->flags |= CAM_IOSCHED_FLAG_CALLOUT_ACTIVE;
 	}
 #endif



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