Hi Ming On 08/20/2018 10:24 AM, Ming Lei wrote: >> The code path is: >> >> elevator_release >> -> elevator_put(e->type) >> -> module_put(e->elevator_owner) >> >> In normal elevator switch path, elevator_get will hold a reference counter of the >> elevator_owner. >> In this patch set, the elevator_type is saved directly. To prevent the io scheduler module >> is removed, we need to hold a reference of the module. > Yeah, I agree that the module reference need to be held, but it need to be > released too. > > My concern is that this introduced getting module reference in your patch > isn't released. The module reference is a counter too, so the get and > put operation should be matched. elevator_switch_mq -> elevator_exit it will put a reference count of the elevator_queue associated with the request_queue. and the elevator_release will be invoked when the reference count of elevator_queue->kobj reaches zero. elevator_release will put the reference count of the io scheduler module. the elevator_queue structure will be allocated and freed every time when we switch io scheduler. so the elevator_release will always be invoked. This is the put ref corresponding to the get one in this patch. Thanks Jianchao