All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Jan Kara <jack@suse.cz>
Cc: 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 09:05:12 +0900	[thread overview]
Message-ID: <ae8fbc74-64b7-2d2e-ba46-cc72851e30b5@opensource.wdc.com> (raw)
In-Reply-To: <20220616112303.wywyhkvyr74ipdls@quack3.lan>

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 ?

> 
>>> +	if (ioprio_class == IOPRIO_CLASS_NONE)
>>> +		bio->bi_ioprio = get_current_ioprio();
>>>   }
>>>   /**
>>
>> Beside this comment, I am still scratching my head regarding what the user
>> gets with ioprio_get(). If I understood your patches correctly, the user may
>> still see IOPRIO_CLASS_NONE ?
>> For that case, to be in sync with the man page, I thought the returned
>> ioprio should be the effective one based on the task io nice value, that is,
>> the value returned by get_current_ioprio(). Am I missing something... ?
> 
> The trouble with returning "effective ioprio" is that with IOPRIO_WHO_PGRP
> or IOPRIO_WHO_USER the effective IO priority may be different for different
> processes considered and it can be also further influenced by blk-ioprio
> settings. But thinking about it now after things have settled I agree that
> what you suggests makes more sense. I'll fix that. Thanks for suggestion!
> 
> 								Honza


-- 
Damien Le Moal
Western Digital Research

  parent reply	other threads:[~2022-06-17  0:05 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 [this message]
2022-06-17 11:52         ` Jan Kara
2022-06-17 12:00           ` Damien Le Moal
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=ae8fbc74-64b7-2d2e-ba46-cc72851e30b5@opensource.wdc.com \
    --to=damien.lemoal@opensource.wdc.com \
    --cc=Niklas.Cassel@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=jack@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.