lkml.org 
[lkml]   [2022]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] blk-mq: put the reference of the io scheduler module after switching back
From
Date


在 2022/10/13 21:47, Jinlong Chen 写道:
> Hi, Yu Kuai!
>
>>
>> I'm confused here, cause I do think this patch make sense.
>>
>> blk_mq_update_nr_hw_queues
>> // for each queue using the tagset
>> blk_mq_freeze_queue
>> // if current elevator is not none, swith to none
>> blk_mq_elv_switch_none
>> // elevator need to be switched back, got a reference to
>> // prevent module to be removed.
>> __module_get
>> elevator_switch(q, NULL);
>>
>> // switch back from none elevator
>> blk_mq_elv_switch_back
>> -> should release the module reference here
>> blk_mq_unfreeze_queue
>>
>
> We need to release the reference only if blk_mq_elv_switch_back got its own
> reference. However, blk_mq_elv_switch_back (precisely elevator_switch_mq)
> does not increase the reference of the module it is switching to.
> Hence, the reference got in blk_mq_elv_switch_none does not need to be released,
> or we'll have to re-increase the reference count manually.'

But I don't see elevator_switch() release the referenct of the module
it is switching from. It's still not balance to me.

Thanks,
Kuai
>
>>
>> By the way, I do not test yet, but I think problem can be reporduced:
>>
>>
>> 1. modprobe bfq
>> 2. switch elevator to bfq
>> 3. trigger blk_mq_update_nr_hw_queues
>> 4. switch elevator to none
>> 5. rmmod bfq will fail
>>
>
> I tried to reproduce the problem but failed, so I found my mistake.
>
> Sincerely,
> Jinlong Chen
> .
>

\
 
 \ /
  Last update: 2022-10-13 16:08    [W:0.115 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site