From: Jens Axboe <axboe@kernel.dk>
To: Hui Su <sh_def@163.com>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block/elevator: reduce the critical section
Date: Mon, 19 Oct 2020 10:50:32 -0600 [thread overview]
Message-ID: <e63eb362-a1fc-f746-b5cb-b58d76fd3d06@kernel.dk> (raw)
In-Reply-To: <20201019164246.GA79115@rlk>
On 10/19/20 10:42 AM, Hui Su wrote:
> 1.reduce the critical section in elevator_get().
> 2.reduce the critical section in elevator_get_by_features().
> 3.remove the found variable.
>
> the elv_list_lock is used to protect the elv_list,
> and the operations of elevator_type does not need
> to be protected.
>
> Signed-off-by: Hui Su <sh_def@163.com>
> ---
> block/elevator.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/block/elevator.c b/block/elevator.c
> index 293c5c81397a..727902b31954 100644
> --- a/block/elevator.c
> +++ b/block/elevator.c
> @@ -151,11 +151,11 @@ static struct elevator_type *elevator_get(struct request_queue *q,
> spin_lock(&elv_list_lock);
> e = elevator_find(name, q->required_elevator_features);
> }
> + spin_unlock(&elv_list_lock);
>
> if (e && !try_module_get(e->elevator_owner))
> e = NULL;
>
> - spin_unlock(&elv_list_lock);
> return e;
> }
What happens for:
A B
spin_unlock(&elv_list_lock);
rmmod -> elv_unregister();
try_module_get();
--
Jens Axboe
next prev parent reply other threads:[~2020-10-19 16:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-19 16:42 [PATCH] block/elevator: reduce the critical section Hui Su
2020-10-19 16:50 ` Jens Axboe [this message]
2020-10-19 17:23 ` Jens Axboe
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=e63eb362-a1fc-f746-b5cb-b58d76fd3d06@kernel.dk \
--to=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sh_def@163.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