[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 1/6] xen: add reference counter support
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Thu, 16 Mar 2023 17:21:31 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=U9FPdzpEK1a0l9hJxqpKq0e6u6wHhVLJRMnS9kafa4E=; b=WDBhvkGh/DlIF0PDElnU+9XKDJgX/S0MY1GDlmppJjD7LA1/m1DGU7109MAVxo1ZaZbIBA6oRUCQZHJfIgnuUGqYXweG8wLlw0xaIyDezBZeHJLL5QfPW4WPijWl+AHRunkLqTKpnMID72SILmEOU06E3UvCgSpADbEyeovXlSKoekH3Bs+HhS5ry5Yvclk07+NIHHBGSSMzc7MJNK2Hwz4cesm5aCpzH3rkIgPF8axJ0SSe3usQ9YrrR77+SFq4JfycEVWXWdUm8zvlOQyuU7ECPTJt8rQU6hJU/JbA0+OZhi5SGExQrV7jdayZr3Kdl2NDxsqowVv/aunmlFPHRA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ev/uZxcMwMkf0dz0qTn3CnD4DbmSKIa7YVP3+eVao54cz0VSYw+6Pl65GqnbwBwsBA4kV0qPrsr8ThBbVWwxe58fmg++CMDwsgxQdN8/3AE89GLpRH0hDcNHzbG5bM+UbH2MyW6h79RQkmWvJ6gYyenmhbYHL9Qhrb0Fqtf2OtOhxirOaDvh3SHcIi5u237Kg/inzEq2T/8dB3JUNSPKivp6P2T6rM2IqHXri1OLlGiEoFiG+ER+YAXd1gI5NBmq2Ccmy5jvy0lUIMjXp/IKubtA/4zHq6nVsku8V1O7+mJ2JBerz3V1wsE2oNxLpCsW0Dnil9AkKopBLHBWZg3wEQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Thu, 16 Mar 2023 16:21:54 +0000
- Ironport-data: A9a23:MzPSXqm1fJ0BzW3fApkBmr3o5gxiJ0RdPkR7XQ2eYbSJt1+Wr1Gzt xIZCGrTbPzbMTGhctkjOYmwpB8AupGHyYMyTQtt/ywyQSMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+a6U6icfHgqH2eIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE4p7aSaVA8w5ARkPqgQ5QGGyBH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 ewhKCJcLSuhu+yzkauBevMytPU8cOC+aevzulk4pd3YJdAPZMmZBoD1v5pf1jp2gd1SF/HDY cZfcSBocBnLfxxIPBEQFY46m+CrwHL4dlW0qnrM/fZxvzeVklI3jOiF3Nn9I7RmQe1PmUmVv CTe9nnRCRAGLt2PjzGC9xpAg8eWxXqiBN1DSuzQGvhCgn+h+kABFgEtVka9mOiC23OUROh7J BlBksYphe1onKCxdfH/VRClpH+PvjYHRsFdVeY97Wml2qfSpgqUGGUAZjpAc8A98t87QyQw0 V2ElM+vAiZg2JWXVHac+7G8vT60fy8PIgcqfjQYRAEI593ipoAbjR/VSNtnVqmvgbXdBjXY0 z2M6i8kiN07s8kP0Kmq+EHdtBilrJPJUw0d6x3eWySu6QYRWWK+T4mh6Fye6OkaKo+cFwOFp CJcx5jY6/0SB5aQkiDLWP8KALyi+/eCNnvbnEJrGJ4isT+q/hZPYLxt3d23H28xWu5sRNMjS Ba7Vd95jHOLAEaXUA==
- Ironport-hdrordr: A9a23:q4YL06+BwoN+mdWbhGtuk+AuI+orL9Y04lQ7vn2ZKSY5TiVXra CTdZUgpHnJYVMqMk3I9uruBEDtex3hHNtOkOss1NSZLW7bUQmTXeJfBOLZqlWNJ8S9zJ856U 4JScND4bbLfDxHZKjBgTVRE7wbsaa6GKLDv5ah85+6JzsaGp2J7G1Ce3am+lUdfng+OXKgfq Dsm/auoVCbCAwqR/X+PFYpdc7ZqebGkZr3CCR2eyLOuGG1/EiVAKeRKWnj4isj
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Thu, Mar 16, 2023 at 03:03:42PM +0100, Jan Beulich wrote:
> On 16.03.2023 14:54, Roger Pau Monné wrote:
> > On Tue, Mar 14, 2023 at 08:56:29PM +0000, Volodymyr Babchuk wrote:
> >> +{
> >> + return atomic_read(&refcnt->refcnt);
> >> +}
> >> +
> >> +static inline void refcnt_get(refcnt_t *refcnt)
> >> +{
> >> + int old = atomic_add_unless(&refcnt->refcnt, 1, 0);
> >> +
> >> + if ( unlikely(old < 0) || unlikely (old + 1 < 0) )
> > ^ extra space
> >
> > You want a single unlikely for both conditions.
>
> Are you sure? My experience was generally the other way around: likely()
> and unlikely() become ineffectual as soon as the compiler needs more
> than one branch for the inner construct (ie generally for and && or ||).
Oh, OK, never mind then. We have examples of both in the code base.
Roger.
|