diff options
author | Warner Losh <imp@FreeBSD.org> | 2017-09-22 02:36:32 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2017-09-22 02:36:32 +0000 |
commit | f777123b838fc0f2ac5ebc448384cebcedf0ab49 (patch) | |
tree | cf57d1f28f39ba5480af078b9f8693d8d32ed102 | |
parent | cc05c7d2567cb3f1ac1012e3347db88ad363818c (diff) | |
download | src-f777123b838fc0f2ac5ebc448384cebcedf0ab49.tar.gz src-f777123b838fc0f2ac5ebc448384cebcedf0ab49.zip |
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 <fk@fabiankeil.de>
Obtained from: ElectroBSD
PR: 221974
Notes
Notes:
svn path=/head/; revision=323893
-rw-r--r-- | sys/cam/cam_iosched.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/cam/cam_iosched.c b/sys/cam/cam_iosched.c index cfbd3d0784bc..63d774f0a0cf 100644 --- a/sys/cam/cam_iosched.c +++ b/sys/cam/cam_iosched.c @@ -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; } |