diff options
author | 2022-12-05 19:57:04 +0800 | |
---|---|---|
committer | 2022-12-05 13:44:42 -0700 | |
commit | 183daeb11de871b073515d14ec1e3bc0da79e038 (patch) | |
tree | 1cc9b4295e6d38c26aac493e8efa4956d2a569d8 /tools/perf/scripts/python/exported-sql-viewer.py | |
parent | blk-throttle: ignore cgroup without io queued in blk_throtl_cancel_bios (diff) | |
download | wireguard-linux-183daeb11de871b073515d14ec1e3bc0da79e038.tar.xz wireguard-linux-183daeb11de871b073515d14ec1e3bc0da79e038.zip |
blk-throttle: correct calculation of wait time in tg_may_dispatch
In C language, When executing "if (expression1 && expression2)" and
expression1 return false, the expression2 may not be executed.
For "tg_within_bps_limit(tg, bio, bps_limit, &bps_wait) &&
tg_within_iops_limit(tg, bio, iops_limit, &iops_wait))", if bps is
limited, tg_within_bps_limit will return false and
tg_within_iops_limit will not be called. So even bps and iops are
both limited, iops_wait will not be calculated and is always zero.
So wait time of iops is always ignored.
Fix this by always calling tg_within_bps_limit and tg_within_iops_limit
to get wait time for both bps and iops.
Observed that:
1. Wait time in tg_within_iops_limit/tg_within_bps_limit need always
be stored as wait argument is always passed.
2. wait time is stored to zero if iops/bps is limited otherwise non-zero
is stored.
Simpfy tg_within_iops_limit/tg_within_bps_limit by removing wait argument
and return wait time directly. Caller tg_may_dispatch checks if wait time
is zero to find if iops/bps is limited.
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Kemeng Shi <shikemeng@huawei.com>
Link: https://lore.kernel.org/r/20221205115709.251489-5-shikemeng@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions