Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7391022ybp; Wed, 16 Oct 2019 08:01:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqyP7VFP1tbEgNhXh/eL2VYEjhX5RK3FwHxM8xnL+6qj4eBJ/GTHGCpbgPyfpscPNtOtad9K X-Received: by 2002:a50:b901:: with SMTP id m1mr40069046ede.203.1571238100486; Wed, 16 Oct 2019 08:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571238100; cv=none; d=google.com; s=arc-20160816; b=IbHOn3G1AAs+iuGdUyMjOwpyjSxngVJxl0SuSjJDlP+2F871ouzAu5lyp20tDe5fTJ mnPqr2ec12f4IfQwS/XMGIJSaYzwptKv/Ay5O4g/GCcVouWn27fn4XRrTIvPc19kkSWs 3xJbjqqe1VuYS9V0PZEihJUOCl+hO6gR7j0AXlNIKKUTxO7VsN+cGkdw7lPSUUp0o66i 6oTlfSM7+ztN0OBnb4i7s3v/5ovg93J9tlPcsoWA3eSobQS8rvFcVqP3UReugA+Nxamb kEIuTgnQij2/qGRMDKmGTY2orKvTAoDPagp31k1vpB3hZPeUGTul+0ia8mqLMJJHZq/j b3uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=vWDFYE5VfMk8PYd6tGcQlmZsbRyCJde/FdCDoEDlBY8=; b=KeAAF4Ut07DCyukEc7dpLTG+wKOmmm+kSrsh6xIWtEQSN2GHIR9YCTS1lZ2C5+gilj C/YyAivvjVF9ws5IEePjNprl0y8SwNZbqDOws/SABMHEpCubaf3BKgAKBj8k1nSQHAtk bqaBf/Cp6v4Cm7RYKbousET0Vfwz1TJ3auSbP4r2wscG832NZbcjdpk3uGM54JF1hkxR pmSqm1Jo550oXsUXKUrNgGZ1HClF7l0mM8Hwz3PMsB6tlfgsLkGIGJ/zvOg9V5aamKxS Kt+jhui4gOOukUBdp+3dSByUXHyIMOCEOti04B6r/dcNkCe2fn0KsW6l2YswWmcXG1JU jryg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r19si15569485eji.376.2019.10.16.08.01.16; Wed, 16 Oct 2019 08:01:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392776AbfJPLWU (ORCPT + 99 others); Wed, 16 Oct 2019 07:22:20 -0400 Received: from foss.arm.com ([217.140.110.172]:37098 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392658AbfJPLWU (ORCPT ); Wed, 16 Oct 2019 07:22:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C421728; Wed, 16 Oct 2019 04:22:19 -0700 (PDT) Received: from [10.37.9.204] (unknown [10.37.9.204]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ACC403F6C4; Wed, 16 Oct 2019 04:22:14 -0700 (PDT) Subject: Re: [PATCHv7 18/33] lib/vdso: Add unlikely() hint into vdso_read_begin() To: Dmitry Safonov , linux-kernel@vger.kernel.org Cc: Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , Adrian Reber , Andrei Vagin , Andy Lutomirski , Arnd Bergmann , Christian Brauner , Cyrill Gorcunov , "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jann Horn , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , containers@lists.linux-foundation.org, criu@openvz.org, linux-api@vger.kernel.org, x86@kernel.org References: <20191011012341.846266-1-dima@arista.com> <20191011012341.846266-19-dima@arista.com> From: Vincenzo Frascino Message-ID: <100f6921-9081-7eb0-7acc-f10cfb647c21@arm.com> Date: Wed, 16 Oct 2019 12:24:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191011012341.846266-19-dima@arista.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/11/19 2:23 AM, Dmitry Safonov wrote: > From: Andrei Vagin > > Place the branch with no concurrent write before contended case. > > Performance numbers for Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz > (more clock_gettime() cycles - the better): > | before | after > ----------------------------------- > | 150252214 | 153242367 > | 150301112 | 153324800 > | 150392773 | 153125401 > | 150373957 | 153399355 > | 150303157 | 153489417 > | 150365237 | 153494270 > ----------------------------------- > avg | 150331408 | 153345935 > diff % | 2 | 0 > ----------------------------------- > stdev % | 0.3 | 0.1 > > Signed-off-by: Andrei Vagin > Co-developed-by: Dmitry Safonov > Signed-off-by: Dmitry Safonov Reviewed-by: Vincenzo Frascino Tested-by: Vincenzo Frascino > --- > include/vdso/helpers.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/vdso/helpers.h b/include/vdso/helpers.h > index 01641dbb68ef..9a2af9fca45e 100644 > --- a/include/vdso/helpers.h > +++ b/include/vdso/helpers.h > @@ -10,7 +10,7 @@ static __always_inline u32 vdso_read_begin(const struct vdso_data *vd) > { > u32 seq; > > - while ((seq = READ_ONCE(vd->seq)) & 1) > + while (unlikely((seq = READ_ONCE(vd->seq)) & 1)) > cpu_relax(); > > smp_rmb(); > -- Regards, Vincenzo