Created attachment 185947 [details] cam iosched: Schedule cam_iosched_ticker() quanta times per second The attached patch lets cam iosched schedule cam_iosched_ticker() quanta times per second According to callout_reset(9), "[w]hen ticks is used, the callout is scheduled to execute after ticks/hz seconds". It follows that to get quanta calls per second one should specify a tick value of hz / isc->quanta. Previously the value was additionally reduced by one. As a result cam_iosched_ticker() was called more often than requested by the user and expected by some of the limiters. On a system with hz=1000 a quanta value of 200 resulted in 250 calls and a value of 100 in 111 calls. Without the unexplained tick reduction the number of calls matches the quanta value reasonably well. Obtained from: ElectroBSD
It used to be you needed to reduce the number of ticks by one to get the desired behavior from callout. The exact value of quanta doesn't matter too much since the result of this bug is systematic (and we take it into account based on elapsed time). However, this makes the behavior more predictable.
It matters for the iops limiter. I previously thought it would matter for the queue_depth limiter as well but as it doesn't have a "tick function" it probably doesn't.
A commit references this bug: Author: imp Date: Wed Sep 20 21:25:56 UTC 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 Changes: head/sys/cam/cam_iosched.c
A commit references this bug: Author: sbruno Date: Fri May 25 23:18:06 UTC 2018 New revision: 334229 URL: https://svnweb.freebsd.org/changeset/base/334229 Log: MFC r323829 cam iosched: Add a handler for the quanta sysctl to enforce valid values MFC r323831 cam iosched: Schedule cam_iosched_ticker() quanta times per second PR: 221956 221957 Submitted by: imp Approved by: re (marius) Changes: _U stable/11/ stable/11/sys/cam/cam_iosched.c
Re-open
Apologies, was going to reopen due to https://lists.freebsd.org/pipermail/freebsd-stable/2018-May/089005.html Let the mailing list thread continue for now. These (this and bug 221957) should be re-opened if necessary, particularly if re@ required for any subsequent commit/merge approvals