QoS/Bdev: update the Byte rate limit timeslice control

Considering the I/O size is variant from small in byte to
large in megabyte, need to consider the compensation of less
allowed bytes in next timeslice if the current timeslice
sends more bytes down.

Change-Id: I885f0bb21001bd90879aa8622e2b34e3bf78cf6e
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/417829
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
GangCao 2018-07-03 21:43:39 -04:00 committed by Changpeng Liu
parent 1f2e86283c
commit aa2789e926

View File

@ -1222,7 +1222,13 @@ spdk_bdev_channel_poll_qos(void *arg)
/* Reset for next round of rate limiting */
qos->io_submitted_this_timeslice = 0;
qos->byte_submitted_this_timeslice = 0;
/* More bytes sent in the last timeslice, allow less in this timeslice */
if (qos->byte_submitted_this_timeslice > qos->max_byte_per_timeslice) {
qos->byte_submitted_this_timeslice -= qos->max_byte_per_timeslice;
} else {
qos->byte_submitted_this_timeslice = 0;
}
_spdk_bdev_qos_io_submit(qos->ch);