linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zhaoyang Huang <huangzhaoyang@gmail.com>,
	steve.kang@unisoc.com
Subject: Re: [RFC PATCH 1/1] block: introduce activity based ioprio
Date: Wed, 17 Jan 2024 09:29:44 -0800	[thread overview]
Message-ID: <5ff36535-7cd3-4e8f-a477-9d2a98d18dd9@acm.org> (raw)
In-Reply-To: <20240117092348.2873928-1-zhaoyang.huang@unisoc.com>

On 1/17/24 01:23, zhaoyang.huang wrote:
> +static enum dd_prio dd_req_ioprio(struct request *rq)
> +{
> +	enum dd_prio prio;
> +	const u8 ioprio_class = dd_rq_ioclass(rq);
> +#ifdef CONFIG_ACTIVITY_BASED_IOPRIO
> +	struct bio *bio;
> +	struct bio_vec bv;
> +	struct bvec_iter iter;
> +	struct page *page;
> +	int gen = 0;
> +	int cnt = 0;
> +
> +	if (req_op(rq) == REQ_OP_READ) {
> +		__rq_for_each_bio(bio, rq) {
> +			bio_for_each_bvec(bv, bio, iter) {
> +				page = bv.bv_page;
> +				gen += PageWorkingset(page) ? 1 : 0;
> +				cnt++;
> +			}
> +		}
> +		prio = (gen >= cnt / 2) ? ioprio_class_to_prio[IOPRIO_CLASS_RT] :
> +			ioprio_class_to_prio[ioprio_class];
> +	} else
> +		prio = ioprio_class_to_prio[ioprio_class];
> +#else
> +	prio = ioprio_class_to_prio[ioprio_class];
> +#endif
> +	return prio;
> +}

I don't like it that code is introduced in the mq-deadline scheduler
that accesses page cache information. Isn't that a layering violation?
Additionally, this approach only works for buffered I/O and not for
direct I/O. Shouldn't the I/O submitter set the I/O priority instead of
deciding the I/O priority in the mq-deadline scheduler?

Bart.

  parent reply	other threads:[~2024-01-17 17:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17  9:23 [RFC PATCH 1/1] block: introduce activity based ioprio zhaoyang.huang
2024-01-17 15:20 ` Jens Axboe
2024-01-18  7:48   ` Zhaoyang Huang
2024-01-18 15:25     ` Jens Axboe
2024-01-17 17:29 ` Bart Van Assche [this message]
2024-01-18  8:40   ` Zhaoyang Huang

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=5ff36535-7cd3-4e8f-a477-9d2a98d18dd9@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=huangzhaoyang@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steve.kang@unisoc.com \
    --cc=zhaoyang.huang@unisoc.com \
    /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;
as well as URLs for NNTP newsgroup(s).