Re: [PATCHv3 1/2] block: move elevator queue allocation logic into blk_mq_init_sched

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

 




On 6/17/25 8:37 PM, Ming Lei wrote:
> On Mon, Jun 16, 2025 at 11:02:25PM +0530, Nilay Shroff wrote:
>> In preparation for allocating sched_tags before freezing the request
>> queue and acquiring ->elevator_lock, move the elevator queue allocation
>> logic from the elevator ops ->init_sched callback into blk_mq_init_sched.
>>
>> This refactoring provides a centralized location for elevator queue
>> initialization, which makes it easier to store pre-allocated sched_tags
>> in the struct elevator_queue during later changes.
>>
>> Signed-off-by: Nilay Shroff <nilay@xxxxxxxxxxxxx>
>> ---

[...]

>> diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
>> index 55a0fd105147..d914eb9d61a6 100644
>> --- a/block/blk-mq-sched.c
>> +++ b/block/blk-mq-sched.c
>> @@ -475,6 +475,10 @@ int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e)
>>  	q->nr_requests = 2 * min_t(unsigned int, q->tag_set->queue_depth,
>>  				   BLKDEV_DEFAULT_RQ);
>>  
>> +	eq = elevator_alloc(q, e);
>> +	if (!eq)
>> +		return -ENOMEM;
>> +
>>  	if (blk_mq_is_shared_tags(flags)) {
>>  		ret = blk_mq_init_sched_shared_tags(q);
>>  		if (ret)
> 
> The above failure needs to be handled by kobject_put(&eq->kobj).

I think here the elevator_alloc() failure occurs before we initialize 
eq->kobj. So we don't need to handle it with kobject_put(&eq->kobj)
and instead simply returning -ENOMEM should be sufficient. Agree?

> 
> Otherwise, feel free to add:
> 
> Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx>
> 

Thanks,
--Nilay






[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