qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: 王洪浩 <wanghonghao@bytedance.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: kwolf@redhat.com, pbonzini@redhat.com, fam@euphon.net,
	qemu-devel@nongnu.org
Subject: Re: [External] Re: [PATCH 1/2] QSLIST: add atomic replace operation
Date: Tue, 25 Aug 2020 11:33:39 +0800	[thread overview]
Message-ID: <CADzM5uTTB31+-y0MQbEgX0WxXk1pipSzYDtsAc=UkW4RDExP-g@mail.gmail.com> (raw)
In-Reply-To: <20200824152659.GA7124@stefanha-x1.localdomain>

This function is indeed a bit vague in semantics.
I'll modify this function to make it more in line with `replace`.

Stefan Hajnoczi <stefanha@redhat.com> 于2020年8月24日周一 下午11:27写道:
>
> On Mon, Aug 24, 2020 at 12:31:20PM +0800, wanghonghao wrote:
> > Replace a queue with another atomicly. It's useful when we need to transfer
> > queues between threads.
> >
> > Signed-off-by: wanghonghao <wanghonghao@bytedance.com>
> > ---
> >  include/qemu/queue.h | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/include/qemu/queue.h b/include/qemu/queue.h
> > index 456a5b01ee..a3ff544193 100644
> > --- a/include/qemu/queue.h
> > +++ b/include/qemu/queue.h
> > @@ -226,6 +226,10 @@ struct {                                                                \
> >          (dest)->slh_first = atomic_xchg(&(src)->slh_first, NULL);        \
> >  } while (/*CONSTCOND*/0)
> >
> > +#define QSLIST_REPLACE_ATOMIC(dest, src) do {                                 \
> > +        (src)->slh_first = atomic_xchg(&(dest)->slh_first, (src)->slh_first); \
> > +} while (/*CONSTCOND*/0)
>
> This is atomic for dest but not src.
>
> Maybe the name should make this clear: QSLIST_REPLACE_ATOMIC_DEST().
>
> Please also add a doc comment mentioning that the modification to src is
> not atomic.
>
> Stefan


  reply	other threads:[~2020-08-25  3:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24  4:31 [PATCH 1/2] QSLIST: add atomic replace operation wanghonghao
2020-08-24  4:31 ` [PATCH 2/2] coroutine: take exactly one batch from global pool at a time wanghonghao
2020-08-25 14:52   ` Stefan Hajnoczi
2020-08-26  6:06     ` [External] " 王洪浩
2020-09-29  3:24       ` PING: " 王洪浩
2020-10-13 10:04         ` Stefan Hajnoczi
2020-08-24 15:26 ` [PATCH 1/2] QSLIST: add atomic replace operation Stefan Hajnoczi
2020-08-25  3:33   ` 王洪浩 [this message]
2020-08-25  3:37   ` [PATCH v2 " wanghonghao
2020-08-25  3:37     ` [PATCH v2 2/2] coroutine: take exactly one batch from global pool at a time wanghonghao

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='CADzM5uTTB31+-y0MQbEgX0WxXk1pipSzYDtsAc=UkW4RDExP-g@mail.gmail.com' \
    --to=wanghonghao@bytedance.com \
    --cc=fam@euphon.net \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@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).