mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>
Cc: Jens Axboe <axboe@kernel.dk>, Yu Zhao <yuzhao@google.com>,
	linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Zhaoyang Huang <huangzhaoyang@gmail.com>,
	steve.kang@unisoc.com
Subject: Re: [PATCHv7 1/1] block: introduce content activity based ioprio
Date: Mon, 5 Feb 2024 07:08:30 +0000	[thread overview]
Message-ID: <ZcCJbtX3xwBRCqYJ@casper.infradead.org> (raw)
In-Reply-To: <20240205055705.7078-1-zhaoyang.huang@unisoc.com>

On Mon, Feb 05, 2024 at 01:57:05PM +0800, zhaoyang.huang wrote:
> +/*
> + * bio_set_active_ioprio() is helper function for fs to adjust the bio's ioprio via
> + * calculating the content's activity which measured from MGLRU.
> + * The file system should call this function before submit_bio for the buffered
> + * read/write/sync.
> + */
> +#ifdef CONFIG_BLK_CONT_ACT_BASED_IOPRIO
> +void bio_set_active_ioprio(struct bio *bio)
> +{
> +	struct bio_vec bv;
> +	struct bvec_iter iter;
> +	struct page *page;
> +	int class, level, hint;
> +	int activity = 0;
> +	int cnt = 0;
> +
> +	class = IOPRIO_PRIO_CLASS(bio->bi_ioprio);
> +	level = IOPRIO_PRIO_LEVEL(bio->bi_ioprio);
> +	hint = IOPRIO_PRIO_HINT(bio->bi_ioprio);
> +	/*apply legacy ioprio policy on RT task*/
> +	if (task_is_realtime(current)) {
> +		bio->bi_ioprio = IOPRIO_PRIO_VALUE_HINT(IOPRIO_CLASS_RT, level, hint);
> +		return;
> +	}
> +	bio_for_each_bvec(bv, bio, iter) {
> +		page = bv.bv_page;

I gave you the prototype:

: No, stop this.  What the filesystem needs to do is not
: s/bio_add_folio/act_bio_add_folio/.  There needs to be an API to set the
: bio prio; something like:
: 
:         bio_set_active_prio(bio, folio);

Do not iterate over the bio.  Use the folio provided to set the prio.

Or is there some reason this doesn't work?

  parent reply	other threads:[~2024-02-05  7:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05  5:57 zhaoyang.huang
2024-02-05  6:21 ` Zhaoyang Huang
2024-02-05  7:08 ` Matthew Wilcox [this message]
2024-02-05  7:13   ` 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=ZcCJbtX3xwBRCqYJ@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=huangzhaoyang@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steve.kang@unisoc.com \
    --cc=yuzhao@google.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

all inboxes | Powered by JetHome®