[Devel] [PATCH hci-8.1] ms/block: drop the cached plug time when blk_add_rq_to_plug() flushes
no-reply at sashiko.virtuozzo.com
no-reply at sashiko.virtuozzo.com
Thu Oct 1 18:28:15 MSK 2026
> blk_time_get_ns() caches the current time in the task's plug. The idea
> is that the cache lives for one plug and is dropped when the plug is
> flushed. __blk_flush_plug() and finish_task_switch() do that.
>
> blk_add_rq_to_plug() also flushes, when the plug has too many requests
> or the last request is at least BLK_PLUG_FLUSH_SIZE. But it calls
> blk_mq_flush_plug_list() directly and never drops the cached time. So
> a task that keeps submitting without sleeping stamps every request
> after that with the time first cached in the plug. start_time_ns and
> io_start_time_ns are stale and the disk stats charge each request for
> the whole time since the plug began.
>
> Drop the cached time after the flush, same as __blk_flush_plug() does.
>
> Fixes: da4c8c3d0975 ("block: cache current nsec time in struct blk_plug")
> Cc: stable at vger.kernel.org
> Signed-off-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
> Link: https://patch.msgid.link/20260930-blk-plug-ts-flush-v1-1-bf8ca7bc5cd6@virtuozzo.com
> Signed-off-by: Jens Axboe <axboe at kernel.dk>
>
> (cherry picked from commit e0f2224433b15a57125d6ac5d46182f99c6c9d08)
>
> Rebase note: the commit is in the block tree (axboe/linux.git) and not
> in mainline yet. In this kernel blk_plug_invalidate_ts() still takes
> the task as an argument, so pass current.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-147945
> Feature: fix ms/block
>
> Signed-off-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261001-blk-flush-ts-plug-v1-1-22d9a1f0c9bf@virtuozzo.com?part=1
More information about the Devel
mailing list