qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] thread-pool: clean up thread_pool_completion_bh


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] thread-pool: clean up thread_pool_completion_bh()
Date: Thu, 02 Apr 2015 19:12:03 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


On 02/04/2015 18:39, Stefan Hajnoczi wrote:
> This patch simplifies thread_pool_completion_bh().
> 
> The function first checks elem->state:
> 
>   if (elem->state != THREAD_DONE) {
>       continue;
>   }
> 
> It then goes on to check elem->state == THREAD_DONE although we already
> know this must be the case.

And not once, twice. :)

This was the outcome of removing THREAD_CANCELED.

> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
>  thread-pool.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/thread-pool.c b/thread-pool.c
> index e2cac8e..ac909f4 100644
> --- a/thread-pool.c
> +++ b/thread-pool.c
> @@ -170,12 +170,12 @@ restart:
>          if (elem->state != THREAD_DONE) {
>              continue;
>          }
> -        if (elem->state == THREAD_DONE) {
> -            trace_thread_pool_complete(pool, elem, elem->common.opaque,
> -                                       elem->ret);
> -        }
> -        if (elem->state == THREAD_DONE && elem->common.cb) {
> -            QLIST_REMOVE(elem, all);
> +
> +        trace_thread_pool_complete(pool, elem, elem->common.opaque,
> +                                   elem->ret);
> +        QLIST_REMOVE(elem, all);
> +
> +        if (elem->common.cb) {
>              /* Read state before ret.  */
>              smp_rmb();
>  
> @@ -188,8 +188,6 @@ restart:
>              qemu_aio_unref(elem);
>              goto restart;
>          } else {
> -            /* remove the request */
> -            QLIST_REMOVE(elem, all);
>              qemu_aio_unref(elem);
>          }
>      }
> 

Reviewed-by: Paolo Bonzini <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]