Re: [PATCH] block: drop the cached plug time when blk_add_rq_to_plug() flushes

From: Jens Axboe

Date: Thu Oct 01 2026 - 11:13:36 EST



On Wed, 30 Sep 2026 14:32:26 +0000, Vasileios Almpanis wrote:
> 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.
>
> [...]

Applied, thanks!

[1/1] block: drop the cached plug time when blk_add_rq_to_plug() flushes
commit: e0f2224433b15a57125d6ac5d46182f99c6c9d08

Best regards,
--
Jens Axboe