From: Paolo Bonzini <pbonzini@redhat.com>
To: liu ping fan <qemulist@gmail.com>
Cc: qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v2] atomic: using memory_order_relaxed for refcnt inc/dec ops
Date: Mon, 15 Jul 2013 12:39:17 +0200 [thread overview]
Message-ID: <51E3D155.7040406@redhat.com> (raw)
In-Reply-To: <CAJnKYQnNv9dJ-jPEsYcDM=kKLMr9r75J1UJLSu29hw6rVaeY+A@mail.gmail.com>
Il 14/07/2013 12:23, liu ping fan ha scritto:
>> if the refcount ops are frequent enough, I strongly suspect cacheline
>> bouncing has a bigger effect than the memory barriers.
>>
> When out of biglock, object_ref/unref to pin the Device will be quite
> often, and can it be marked "frequent"? Or how can we say something is
> frequent?
I didn't say it is not frequent. I said I suspect (it _is_ just a
suspicion, not the result of a benchmark, but at least I said so...)
that "cacheline bouncing has a bigger effect than the memory barriers"
and thus the API would not have such a dramatic impact.
>> Third, it is making the API completely unorthogonal, and "tend to be
>> exceptions" is not a justification.
>>
>> The justification here could be, rather than the performance, having to
>> remember how to use atomic_fetch_dec in the unref side. I don't really
>> buy that, but if you really care, do something like
>>
>> #define atomic_ref(ptr, field)
>> #define atomic_unref(ptr, field, releasefn)
>>
>> i.e. define a new interface similar to kref_get/kref_put and, since you
>> are at it, optimize it.
>>
> Thanks, a abstract layer for refct is what I need.
If someone cares enough to review your patch (which _must_ come with
documentation), that's fine for me. I don't think it's worthwhile, but
others may disagree.
Paolo
prev parent reply other threads:[~2013-07-15 10:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-14 2:53 [Qemu-devel] [PATCH v2] atomic: using memory_order_relaxed for refcnt inc/dec ops Liu Ping Fan
2013-07-14 5:57 ` Paolo Bonzini
2013-07-14 10:23 ` liu ping fan
2013-07-15 10:39 ` Paolo Bonzini [this message]
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=51E3D155.7040406@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemulist@gmail.com \
--cc=rth@twiddle.net \
/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).