From: Jan Kara <jack@suse.cz>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Cc: Jan Kara <jack@suse.cz>, Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org,
Niklas Cassel <Niklas.Cassel@wdc.com>,
Bart Van Assche <bvanassche@acm.org>
Subject: Re: [PATCH 8/8] block: Always initialize bio IO priority on submit
Date: Fri, 17 Jun 2022 13:52:08 +0200 [thread overview]
Message-ID: <20220617115208.mv55swrdcf44tw5a@quack3> (raw)
In-Reply-To: <ae8fbc74-64b7-2d2e-ba46-cc72851e30b5@opensource.wdc.com>
On Fri 17-06-22 09:05:12, Damien Le Moal wrote:
> On 6/16/22 20:23, Jan Kara wrote:
> > On Thu 16-06-22 12:15:25, Damien Le Moal wrote:
> >> On 6/16/22 01:16, Jan Kara wrote:
> >>> Currently, IO priority set in task's IO context is not reflected in the
> >>> bio->bi_ioprio for most IO (only io_uring and direct IO set it). This
> >>> results in odd results where process is submitting some bios with one
> >>> priority and other bios with a different (unset) priority and due to
> >>> differing priorities bios cannot be merged. Make sure bio->bi_ioprio is
> >>> always set on bio submission.
> >>>
> >>> Signed-off-by: Jan Kara <jack@suse.cz>
> >>> ---
> >>> block/blk-mq.c | 6 ++++++
> >>> 1 file changed, 6 insertions(+)
> >>>
> >>> diff --git a/block/blk-mq.c b/block/blk-mq.c
> >>> index e17d822e6051..e976f696babc 100644
> >>> --- a/block/blk-mq.c
> >>> +++ b/block/blk-mq.c
> >>> @@ -2793,7 +2793,13 @@ static inline struct request *blk_mq_get_cached_request(struct request_queue *q,
> >>> static void bio_set_ioprio(struct bio *bio)
> >>> {
> >>> + unsigned short ioprio_class;
> >>> +
> >>> blkcg_set_ioprio(bio);
> >>
> >> Shouldn't this function set the default using the below "if" code ?
> >>
> >>> + ioprio_class = IOPRIO_PRIO_CLASS(bio->bi_ioprio);
> >>> + /* Nobody set ioprio so far? Initialize it based on task's nice value */
> >>
> >> I do not think that the ioprio_class variable is useful.
> >> This can be:
> >>
> >> if (IOPRIO_PRIO_CLASS(bio->bi_ioprio) == IOPRIO_CLASS_NONE)
> >> bio->bi_ioprio = get_current_ioprio();
> >
> > You are right. Fixed.
>
> What about moving this inside blkcg_set_ioprio() ? bio_set_ioprio() would
> then not be needed at all and blkcg_set_ioprio() called directly ?
What I dislike about this is that it is counterintuitive that
blkcg_set_prio() does anything when blkcgs are disabled in kernel config
(and it would have to to keep things working). So if you dislike
bio_set_ioprio(), I can just opencode this function in its single call
site. Would that be better?
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2022-06-17 11:52 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-15 16:16 [PATCH 0/8 v2] block: Fix IO priority mess Jan Kara
2022-06-15 16:16 ` [PATCH 1/8] block: Fix handling of tasks without ioprio in ioprio_get(2) Jan Kara
2022-06-15 16:16 ` [PATCH 2/8] block: Make ioprio_best() static Jan Kara
2022-06-15 16:16 ` [PATCH 3/8] block: fix default IO priority handling again Jan Kara
2022-06-15 16:16 ` [PATCH 4/8] block: Return effective IO priority from get_current_ioprio() Jan Kara
2022-06-15 16:16 ` [PATCH 5/8] blk-ioprio: Remove unneeded field Jan Kara
2022-06-15 16:16 ` [PATCH 6/8] blk-ioprio: Convert from rqos policy to direct call Jan Kara
2022-06-16 3:14 ` Damien Le Moal
2022-06-15 16:16 ` [PATCH 7/8] block: Initialize bio priority earlier Jan Kara
2022-06-15 16:16 ` [PATCH 8/8] block: Always initialize bio IO priority on submit Jan Kara
2022-06-16 3:15 ` Damien Le Moal
2022-06-16 11:23 ` Jan Kara
2022-06-16 12:24 ` Jan Kara
2022-06-17 0:04 ` Damien Le Moal
2022-06-17 11:49 ` Jan Kara
2022-06-17 12:03 ` Damien Le Moal
2022-06-17 14:54 ` Jan Kara
2022-06-17 0:05 ` Damien Le Moal
2022-06-17 11:52 ` Jan Kara [this message]
2022-06-17 12:00 ` Damien Le Moal
-- strict thread matches above, loose matches on Subject: below --
2022-06-20 16:11 [PATCH 0/8 v3] block: Fix IO priority mess Jan Kara
2022-06-20 16:11 ` [PATCH 8/8] block: Always initialize bio IO priority on submit Jan Kara
2022-06-21 0:02 ` Damien Le Moal
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=20220617115208.mv55swrdcf44tw5a@quack3 \
--to=jack@suse.cz \
--cc=Niklas.Cassel@wdc.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=damien.lemoal@opensource.wdc.com \
--cc=linux-block@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