lkml.org 
[lkml]   [2020]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] block/elevator: reduce the critical section
From
Date
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

\
 
 \ /
  Last update: 2020-10-19 18:50    [W:0.066 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site