Skip to content

Commit d80c228

Browse files
brookxu-txaxboe
authored andcommitted
block: fix the problem of io_ticks becoming smaller
On the IO submission path, blk_account_io_start() may interrupt the system interruption. When the interruption returns, the value of part->stamp may have been updated by other cores, so the time value collected before the interruption may be less than part-> stamp. So when this happens, we should do nothing to make io_ticks more accurate? For kernels less than 5.0, this may cause io_ticks to become smaller, which in turn may cause abnormal ioutil values. Signed-off-by: Chunguang Xu <brookxu@tencent.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/1625521646-1069-1-git-send-email-brookxu.cn@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent c6af8db commit d80c228

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

block/blk-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ static void update_io_ticks(struct block_device *part, unsigned long now,
12411241
unsigned long stamp;
12421242
again:
12431243
stamp = READ_ONCE(part->bd_stamp);
1244-
if (unlikely(stamp != now)) {
1244+
if (unlikely(time_after(now, stamp))) {
12451245
if (likely(cmpxchg(&part->bd_stamp, stamp, now) == stamp))
12461246
__part_stat_add(part, io_ticks, end ? now - stamp : 1);
12471247
}

0 commit comments

Comments
 (0)