Skip to content

block/blk-stat: fix mean loss when re-summing aggregated stats - #46

Open
blktests-ci-block-trial[bot] wants to merge 1 commit into
master_basefrom
series/383=>master
Open

block/blk-stat: fix mean loss when re-summing aggregated stats#46
blktests-ci-block-trial[bot] wants to merge 1 commit into
master_basefrom
series/383=>master

Conversation

@blktests-ci-block-trial

Copy link
Copy Markdown

Pull request for series with
subject: block/blk-stat: fix mean loss when re-summing aggregated stats
version: 1
url: http://redsun45:8000/project/linux-block/list/?series=383

blk_rq_stat_sum() folds src into dst but only advances dst->mean and
dst->nr_samples, leaving dst->batch untouched.  The mean is computed
from src->batch (the raw per-cpu sum), so a stat that has already been
through one sum carries batch=0; if that aggregated stat is then used
as the src of another sum, its samples add nothing to the new mean.

iolatency hits exactly that: iolatency_check_latencies() first sums the
per-cpu stats into a local stat, then sums that local stat into
iolat->cur_stat.  After the first sum the local stat has batch=0, so
every later window drives cur_stat->mean toward zero.  On non-SSD
devices it stays at 0, making the latency_sum_ok(&cur_stat) check that
gates scaling up always true -- the scale-up hysteresis is effectively
defeated.  SSD devices use the percentile path and are unaffected.

Keep dst->batch in sync across sums so an aggregated stat can be reused
as a src.  blk_rq_stat.batch is internal to blk_rq_stat_init/_add/_sum
(no other reader in the tree), so the wbt and blk-mq consumers, which
only read ->mean/->min/->nr_samples, behave as before.

Fixes: 34dbad5 ("blk-stat: convert to callback-based statistics reporting")
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
@blktests-ci-block-trial

Copy link
Copy Markdown
Author

Upstream branch: 248951d
series: http://redsun45:8000/project/linux-block/list/?series=383
version: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants