From: Jinlong Chen <chenjinlong2016@outlook.com>
To: yukuai1@huaweicloud.com
Cc: axboe@kernel.dk, chenjinlong2016@outlook.com,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
yukuai3@huawei.com
Subject: Re: [PATCH] blk-mq: put the reference of the io scheduler module after switching back
Date: Thu, 13 Oct 2022 21:47:33 +0800 [thread overview]
Message-ID: <OSYP286MB0344F8B1AC5F35BEA990B593BE259@OSYP286MB0344.JPNP286.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <b79a8187-5342-8ff3-73fc-0324bdfb67fb@huaweicloud.com>
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.
>
> 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
next prev parent reply other threads:[~2022-10-13 13:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 0:35 [PATCH v2] " Jinlong Chen
2022-10-13 13:03 ` [PATCH] " Jinlong Chen
2022-10-13 13:22 ` Yu Kuai
2022-10-13 13:47 ` Jinlong Chen [this message]
2022-10-13 14:05 ` Yu Kuai
2022-10-13 14:18 ` Jinlong Chen
2022-10-14 7:27 ` Yu Kuai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=OSYP286MB0344F8B1AC5F35BEA990B593BE259@OSYP286MB0344.JPNP286.PROD.OUTLOOK.COM \
--to=chenjinlong2016@outlook.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yukuai1@huaweicloud.com \
--cc=yukuai3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®