On Mon, Apr 01, 2019 at 11:25:50AM +0800, jianchao.wang wrote: > Hi Ming > > On 4/1/19 10:52 AM, Ming Lei wrote: > >> percpu_ref_tryget_live() fails if a per-cpu counter is in the "dead" state. > >> percpu_ref_kill() changes the state of a per-cpu counter to the "dead" > >> state. blk_freeze_queue_start() calls percpu_ref_kill(). blk_cleanup_queue() > >> already calls blk_set_queue_dying() and that last function calls > >> blk_freeze_queue_start(). So I think that what you wrote is not correct and > >> that inserting a percpu_ref_tryget_live()/percpu_ref_put() pair in > >> blk_mq_run_hw_queues() or blk_mq_run_hw_queue() would make a difference and > >> also that moving the percpu_ref_exit() call into blk_release_queue() makes > >> sense. > > If percpu_ref_exit() is moved to blk_release_queue(), we still need to > > move freeing of hw queue's resource into blk_release_queue() like what > > the patchset is doing. > > > > Then we don't need to get/put q_usage_counter in blk_mq_run_hw_queues() any more, > > do we? > > IMO, if we could get a way to prevent any attempt to run queue, it would be > better and clearer. It is hard to do that way, and not necessary. I will post V2 soon for review. Thanks, Ming