From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdlFt-0002mT-Tn for qemu-devel@nongnu.org; Wed, 28 Nov 2012 12:17:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TdlFo-0008Q4-2M for qemu-devel@nongnu.org; Wed, 28 Nov 2012 12:17:01 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:46745) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdlFn-0008Pz-SC for qemu-devel@nongnu.org; Wed, 28 Nov 2012 12:16:55 -0500 Received: by mail-pa0-f45.google.com with SMTP id bg2so6986671pad.4 for ; Wed, 28 Nov 2012 09:16:55 -0800 (PST) Sender: Richard Henderson Message-ID: <50B64704.5040606@twiddle.net> Date: Wed, 28 Nov 2012 09:16:52 -0800 From: Richard Henderson MIME-Version: 1.0 References: <1353808984-22368-1-git-send-email-qemulist@gmail.com> <1353808984-22368-2-git-send-email-qemulist@gmail.com> In-Reply-To: <1353808984-22368-2-git-send-email-qemulist@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v7 1/7] qom: apply atomic on object's refcount List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan Cc: Peter Maydell , gleb@redhat.com, Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, Anthony Liguori , Stefan Hajnoczi , Paolo Bonzini On 11/24/2012 06:02 PM, Liu Ping Fan wrote: > - obj->ref--; > > /* parent always holds a reference to its children */ > - if (obj->ref == 0) { > + if (__sync_fetch_and_sub(&obj->ref, 1) == 1) { if (__sync_sub_and_fetch(&obj->ref, 1) == 0) r~