qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] thread-pool: clean up thread_pool_completion_bh()
Date: Thu, 02 Apr 2015 19:12:03 +0200	[thread overview]
Message-ID: <551D7863.3070007@redhat.com> (raw)
In-Reply-To: <1427992762-10126-1-git-send-email-stefanha@redhat.com>



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 <stefanha@redhat.com>
> ---
>  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 <pbonzini@redhat.com>

  reply	other threads:[~2015-04-02 17:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 16:39 [Qemu-devel] [PATCH] thread-pool: clean up thread_pool_completion_bh() Stefan Hajnoczi
2015-04-02 17:12 ` Paolo Bonzini [this message]
2015-04-07 13:45 ` Stefan Hajnoczi

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=551D7863.3070007@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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;
as well as URLs for NNTP newsgroup(s).