summaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/bin/export-to-postgresql-report
diff options
context:
space:
mode:
authorZizhi Wo <wozizhi@huawei.com>2025-04-17 21:20:54 +0800
committerJens Axboe <axboe@kernel.dk>2025-05-05 19:08:34 -0600
commit18b8144a1bd8be5a88cc438c0c9213bae1be1a9d (patch)
tree57b366492aa44d49468fd25414db18db1effdbfd /tools/perf/scripts/python/bin/export-to-postgresql-report
parent7b89d46051ab310096994303b969768c4a9eb18f (diff)
downloadlinux-18b8144a1bd8be5a88cc438c0c9213bae1be1a9d.tar.gz
linux-18b8144a1bd8be5a88cc438c0c9213bae1be1a9d.zip
blk-throttle: Add an additional overflow check to the call calculate_bytes/io_allowed
Now the tg->[bytes/io]_disp type is signed, and calculate_bytes/io_allowed return type is unsigned. Even if the bps/iops limit is not set to max, the return value of the function may still exceed INT_MAX or LLONG_MAX, which can cause overflow in outer variables. In such cases, we can add additional checks accordingly. And in throtl_trim_slice(), if the BPS/IOPS limit is set to max, there's no need to call calculate_bytes/io_allowed(). Introduces the helper functions throtl_trim_bps/iops to simplifies the process. For cases when the calculated trim value exceeds INT_MAX (causing an overflow), we reset tg->[bytes/io]_disp to zero, so return original tg->[bytes/io]_disp because it is the size that is actually trimmed. Signed-off-by: Zizhi Wo <wozizhi@huawei.com> Reviewed-by: Yu Kuai <yukuai3@huawei.com> Link: https://lore.kernel.org/r/20250417132054.2866409-4-wozizhi@huaweicloud.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'tools/perf/scripts/python/bin/export-to-postgresql-report')
0 files changed, 0 insertions, 0 deletions