Re: [PATCH 1/1] null_blk: allow user to set QUEUE_FLAG_NOWAIT

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

 



On 4/12/23 17:47, Chaitanya Kulkarni wrote:
> QUEUE_FLAG_NOWAIT is set by default to mq drivers such null_blk when
> it is used with NULL_Q_MQ mode as a part of QUEUE_FLAG_MQ_DEFAULT that
> gets assigned in following code path see blk_mq_init_allocated_queue():-

Can you fix the grammar/punctuation in this sentence ? Looks like some words are
missing, making it hard to read.

> 
> null_add_dev()
> if (dev->queue_mode == NULL_Q_MQ) {
>         blk_mq_alloc_disk()
>           __blk_mq_alloc_disk()
> 	    blk_mq_init_queue_data()
>               blk_mq_init_allocated_queue()
>                 q->queue_flags |= QUEUE_FLAG_MQ_DEFAULT;
> }
> 
> But it is not set when null_blk is loaded with NULL_Q_BIO mode in following
> code path like other bio drivers do e.g. nvme-multipath :-
> 
> if (dev->queue_mode == NULL_Q_BIO) {
>         nullb->disk = blk_alloc_disk(nullb->dev->home_node);
>         	blk_alloc_disk()
>         	  blk_alloc_queue()
>         	  __alloc_disk_nodw()
> }
> 
> Add a new module parameter nowait and respective configfs attr that will
> set or clear the QUEUE_FLAG_NOWAIT based on a value set by user in
> null_add_dev() irrespective of the queue mode, by default keep it
> enabled to retain the original behaviour for the NULL_Q_MQ mode.

Nope. You are changing the behavior. See below.

> 
> Depending on nowait value use GFP_NOWAIT or GFP_NOIO for the alloction
> in the null_alloc_page() for alloc_pages() and in null_insert_page()
> for radix_tree_preload().   
> 
> Observed performance difference with this patch for fio iouring with
> configfs and non configfs null_blk with queue modes NULL_Q_BIO and
> NULL_Q_MQ:-

[...]

> @@ -983,11 +990,11 @@ static struct nullb_page *null_insert_page(struct nullb *nullb,
>  
>  	spin_unlock_irq(&nullb->lock);
>  
> -	t_page = null_alloc_page();
> +	t_page = null_alloc_page(nullb->dev->nowait ? GFP_NOWAIT : GFP_NOIO);

This can potentially result in failed allocations, so IO errors, which otherwise
would not happen without this change. Not nice. Memory backing also sets
BLK_MQ_F_BLOCKING, which I am not sure is compatible with QUEUE_FLAG_NOWAIT...
Would need to check that again.





[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