From: Hou Tao <houtao@huaweicloud.com>
To: Bart Van Assche <bvanassche@acm.org>, linux-block@vger.kernel.org
Cc: Jan Kara <jack@suse.cz>, Jens Axboe <axboe@kernel.dk>,
cgroups@vger.kernel.org, Tejun Heo <tj@kernel.org>,
Zefan Li <lizefan.x@bytedance.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Jonathan Corbet <corbet@lwn.net>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
houtao1@huawei.com
Subject: Re: [PATCH] blk-ioprio: Introduce promote-to-rt policy
Date: Sun, 5 Feb 2023 15:04:17 +0800 [thread overview]
Message-ID: <ffcf2d84-7f0a-21b7-8840-433227bc6afb@huaweicloud.com> (raw)
In-Reply-To: <aedc240d-7c9e-248a-52d2-c9775f3e8ca1@acm.org>
Hi,
On 2/4/2023 3:45 AM, Bart Van Assche wrote:
> On 2/2/23 17:48, Hou Tao wrote:
>> I don't get it on how to remove IOPRIO_POL_PROMOTION when calculating the final
>> ioprio for bio. IOPRIO_POL_PROMOTION is not used for IOPRIO_CLASS values but
>> used to determinate on how to calculate the final ioprio for bio: choosing the
>> maximum or minimum between blkcg ioprio and original bio bi_ioprio.
>
> Do the block layer code changes shown below implement the functionality that you
> need?
Yes, something like that. The reason for introducing IOPRIO_POL_PROMOTION is to
support other promotion policy (e.g., promote-to-be), but now I think the
possibility of adding other promotion policies is low, so the code below is fine
to me.
>
> Thanks,
>
> Bart.
>
>
>
> diff --git a/block/blk-ioprio.c b/block/blk-ioprio.c
> index 8bb6b8eba4ce..4a56da95168e 100644
> --- a/block/blk-ioprio.c
> +++ b/block/blk-ioprio.c
> @@ -27,6 +27,8 @@
> * @POLICY_RESTRICT_TO_BE: modify IOPRIO_CLASS_NONE and IOPRIO_CLASS_RT into
> * IOPRIO_CLASS_BE.
> * @POLICY_ALL_TO_IDLE: change the I/O priority class into IOPRIO_CLASS_IDLE.
> + * @POLICY_PROMOTE_TO_RT: modify IOPRIO_CLASS_NONE and IOPRIO_CLASS_BE into
> + * IOPRIO_CLASS_RT.
> *
> * See also <linux/ioprio.h>.
> */
> @@ -35,6 +37,7 @@ enum prio_policy {
> POLICY_NONE_TO_RT = 1,
> POLICY_RESTRICT_TO_BE = 2,
> POLICY_ALL_TO_IDLE = 3,
> + POLICY_PROMOTE_TO_RT,
> };
>
> static const char *policy_name[] = {
> @@ -42,6 +45,7 @@ static const char *policy_name[] = {
> [POLICY_NONE_TO_RT] = "none-to-rt",
> [POLICY_RESTRICT_TO_BE] = "restrict-to-be",
> [POLICY_ALL_TO_IDLE] = "idle",
> + [POLICY_PROMOTE_TO_RT] = "promote-to-rt",
> };
>
> static struct blkcg_policy ioprio_policy;
> @@ -189,17 +193,23 @@ void blkcg_set_ioprio(struct bio *bio)
> if (!blkcg || blkcg->prio_policy == POLICY_NO_CHANGE)
> return;
>
> - /*
> - * Except for IOPRIO_CLASS_NONE, higher I/O priority numbers
> - * correspond to a lower priority. Hence, the max_t() below selects
> - * the lower priority of bi_ioprio and the cgroup I/O priority class.
> - * If the bio I/O priority equals IOPRIO_CLASS_NONE, the cgroup I/O
> - * priority is assigned to the bio.
> - */
> - prio = max_t(u16, bio->bi_ioprio,
> - IOPRIO_PRIO_VALUE(blkcg->prio_policy, 0));
> - if (prio > bio->bi_ioprio)
> - bio->bi_ioprio = prio;
> + if (blkcg->prio_policy == PROMOTE_TO_RT) {
> + if (IOPRIO_PRIO_CLASS(bio->bi_ioprio) != IOPRIO_CLASS_RT)
> + bio->bi_ioprio = IOPRIO_CLASS_RT;
> + } else {
> + /*
> + * Except for IOPRIO_CLASS_NONE, higher I/O priority numbers
> + * correspond to a lower priority. Hence, the max_t() below
> + * selects the lower priority of bi_ioprio and the cgroup I/O
> + * priority class. If the bio I/O priority equals
> + * IOPRIO_CLASS_NONE, the cgroup I/O priority is assigned to the
> + * bio.
> + */
> + prio = max_t(u16, bio->bi_ioprio,
> + IOPRIO_PRIO_VALUE(blkcg->prio_policy, 0));
> + if (prio > bio->bi_ioprio)
> + bio->bi_ioprio = prio;
> + }
> }
>
> void blk_ioprio_exit(struct gendisk *disk)
>
next prev parent reply other threads:[~2023-02-05 7:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-01 4:52 [PATCH] blk-ioprio: Introduce promote-to-rt policy Hou Tao
2023-02-01 9:07 ` Bagas Sanjaya
2023-02-02 10:50 ` Hou Tao
2023-02-01 17:33 ` Bart Van Assche
2023-02-02 11:09 ` Hou Tao
2023-02-02 18:05 ` Bart Van Assche
2023-02-03 1:48 ` Hou Tao
2023-02-03 19:45 ` Bart Van Assche
2023-02-05 7:04 ` Hou Tao [this message]
2023-02-08 13:43 ` Jan Kara
2023-02-08 17:53 ` Bart Van Assche
2023-02-09 8:56 ` Jan Kara
2023-02-09 19:09 ` Bart Van Assche
2023-02-10 10:12 ` Jan Kara
2023-02-13 12:51 ` Hou Tao
2023-02-13 17:10 ` Bart Van Assche
2023-02-14 8:52 ` Jan Kara
2023-02-03 19:51 ` Bart Van Assche
2023-02-05 7:17 ` Hou Tao
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=ffcf2d84-7f0a-21b7-8840-433227bc6afb@huaweicloud.com \
--to=houtao@huaweicloud.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=cgroups@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=hannes@cmpxchg.org \
--cc=houtao1@huawei.com \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=tj@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;
as well as URLs for NNTP newsgroup(s).