Re: [PATCH 3/4] block: move queue enter logic into blk_mq_submit_bio()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 03, 2021 at 12:32:21PM -0600, Jens Axboe wrote:
> Retain the old logic for the fops based submit, but for our internal
> blk_mq_submit_bio(), move the queue entering logic into the core
> function itself.

Can you explain the why?  I guess you want to skip the extra reference
for the cached requests now that they already have one.  But please
state that, and explain why it is a fix, as to me it just seems like
another little optimization.

> We need to be a bit careful if going into the scheduler, as a scheduler
> or queue mappings can arbitrarily change before we have entered the queue.
> Have the bio scheduler mapping do that separately, it's a very cheap
> operation compared to actually doing merging locking and lookups.

So just don't do the merges for cache requets and side step this
extra bio_queue_enter for that case?

> -	if (unlikely(bio_queue_enter(bio) != 0))
> -		return;
> -
>  	if (!submit_bio_checks(bio) || !blk_crypto_bio_prep(&bio))
> -		goto queue_exit;
> +		return;

This is broken, we really ant the submit checks under freeze
protection to make sure the parameters can't be changed underneath
us.

> +static inline bool blk_mq_queue_enter(struct request_queue *q, struct bio *bio)
> +{
> +	if (!blk_try_enter_queue(q, false) && bio_queue_enter(bio))
> +		return false;
> +	return true;
> +}

This looks weird, as blk_try_enter_queue is already called by
bio_queue_enter.

>  	} else {
>  		struct blk_mq_alloc_data data = {
>  			.q		= q,
> @@ -2528,6 +2534,11 @@ void blk_mq_submit_bio(struct bio *bio)
>  			.cmd_flags	= bio->bi_opf,
>  		};
>  
> +		if (unlikely(!blk_mq_queue_enter(q, bio)))
> +			return;
> +
> +		rq_qos_throttle(q, bio);
> +

At some point the code in this !cached branch really needs to move
into a helper..



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux