mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Gulam Mohamed <gulam.mohamed@oracle.com>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: Consider inflight IO in io accounting for high latency devices
Date: Fri, 8 Sep 2023 08:33:47 -0600	[thread overview]
Message-ID: <ae3d6e46-eb4f-48f6-99b5-bd0f6588ffbf@kernel.dk> (raw)
In-Reply-To: <20230907214552.130636-1-gulam.mohamed@oracle.com>

On 9/7/23 3:45 PM, Gulam Mohamed wrote:
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index ec922c6bccbe..70e5763fb799 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -1000,6 +1000,8 @@ static inline void blk_account_io_done(struct request *req, u64 now)
>  
>  static inline void blk_account_io_start(struct request *req)
>  {
> +	bool delta = false;
> +

This is an odd name for this variable...

> @@ -1015,7 +1017,10 @@ static inline void blk_account_io_start(struct request *req)
>  			req->part = req->q->disk->part0;
>  
>  		part_stat_lock();
> -		update_io_ticks(req->part, jiffies, false);
> +		if (req->q->nr_hw_queues == 1) {
> +			delta = !!part_in_flight(req->part);
> +		}

No parens needed here. But that aside, I think this could be a lot
better. You don't really care about the number of requests inflight,
only if there are some. A better helper than part_in_flight() could do
that ala:

static bool part_any_in_flight(struct block_device *part)
{
	int cpu;

	for_each_possible_cpu(cpu) {
		if (part_stat_local_read_cpu(part, in_flight[0], cpu) ||
		    part_stat_local_read_cpu(part, in_flight[1], cpu))
			return true;
	}

	return false;
}

But I do wonder if it's just missed state checking for the request
itself that's missing this, and this is fixing it entirely the wrong way
around.

-- 
Jens Axboe


  reply	other threads:[~2023-09-08 14:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-07 21:45 Gulam Mohamed
2023-09-08 14:33 ` Jens Axboe [this message]
2023-09-12 21:01   ` Gulam Mohamed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ae3d6e46-eb4f-48f6-99b5-bd0f6588ffbf@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=gulam.mohamed@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®