Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2053581rwe; Fri, 2 Sep 2022 07:53:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR4kIqMD5BDU7nLpyc0NjKdWA4Y2gpaERXimXLMGud/4RTvyMf8Fk83xRMAY5TM+hzjUGxe1 X-Received: by 2002:a05:6a00:1a49:b0:528:6ea0:14e2 with SMTP id h9-20020a056a001a4900b005286ea014e2mr36021191pfv.22.1662130432952; Fri, 02 Sep 2022 07:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662130432; cv=none; d=google.com; s=arc-20160816; b=AzzwRV2Zhq8cJcygwPJNjtRaHvlcgZUq57fS2wIH16ZTr8tM+IVebUrfatAEw+0+Xf VzjtPecAEQtrGK1f6MpCw7s0ch8jWk5RGD4MwKPVenL/4IDJUnE5eEY5bDtwEKCxPUNF popSVAoCfsNOSLeaTWyOBD7TmJbyxaik0jZ0ezQMyqnO2drnQTINtUYa39u3sYAtmeEb b69BihaHvfvZ5DimlC5SFEkIHtuLLEoxdkAeP9OQEvppepaBZAGuffJWkpAaed+Y0KTC qIMRaDuKpZOiSoLl8jHIeHB4ExYq2xB/2kS2N8n7UJI8S4ofzsOdCmcDlWyAoQ0+2Dg8 yK8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=R+E5goVhChgmner/AV82KLSqZAR6v0SlZUEOBZoRxXk=; b=qH9DxeZkqrV0jTZvr8Ho1iX7rO3UtPD/7im+zzBSf/ogZKm4qeWKFx+xqnICeBOJ+3 FU6RuiiLklb1+bhiCXlilN/+nIGgu9s9YR/6LUySd7wdFl7MYXk68DWD9UksXaU56995 MpNgJbJZ5BNir3j2UcgEfKpWTDzEQXzjLLY4g5Jxwko8HPJxC5YXxPaV78z6sivG9Uhi w1E6qDNLFJfKiWaQmq+xfNPICVV1SWaku5oksjXEX6wZgqi+4UfPVEeOeLct0VBQix21 R7f9LQLBZjMJVlnhvtJQ/qxMLWcTotRyYoRojCsYFH1DxWglovnISMGISl0BuwgTFd6h I+fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hv0cdPCs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jc22-20020a17090325d600b0016c009d3ca2si1977218plb.7.2022.09.02.07.53.40; Fri, 02 Sep 2022 07:53:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hv0cdPCs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236869AbiIBOpy (ORCPT + 99 others); Fri, 2 Sep 2022 10:45:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237146AbiIBOpZ (ORCPT ); Fri, 2 Sep 2022 10:45:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69E4E6B173; Fri, 2 Sep 2022 07:05:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 48965B82AC6; Fri, 2 Sep 2022 12:30:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94244C433C1; Fri, 2 Sep 2022 12:30:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662121810; bh=QjSZCYmT1sbZDjiyqBgLgnsWSWpH1v+Ns5lCvl/ZFLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hv0cdPCsaGfQE0z8GXknqgtWRmlmomRmntPsOOyBLeVfaSRrOWUx2FE1iizfDQ/Wl pGl+9IuEUJOVx4JX55p2H/eLIq5wN66LpoiMM6P/C/7xGBxTFbxbM+5j21GB89UIqR ACGStFssEdsdEtZvWoc7WdYjgZHPWCLWYwkVxvwo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrei Vagin , Dmitry Safonov , Thomas Gleixner , Sasha Levin Subject: [PATCH 5.4 73/77] lib/vdso: Mark do_hres() and do_coarse() as __always_inline Date: Fri, 2 Sep 2022 14:19:22 +0200 Message-Id: <20220902121406.112426098@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902121403.569927325@linuxfoundation.org> References: <20220902121403.569927325@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrei Vagin [ Upstream commit c966533f8c6c45f93c52599f8460e7695f0b7eaa ] Performance numbers for Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz (more clock_gettime() cycles - the better): clock | before | after | diff ---------------------------------------------------------- monotonic | 153222105 | 166775025 | 8.8% monotonic-coarse | 671557054 | 691513017 | 3.0% monotonic-raw | 147116067 | 161057395 | 9.5% boottime | 153446224 | 166962668 | 9.1% The improvement for arm64 for monotonic and boottime is around 3.5%. clock | before | after | diff ================================================== monotonic 17326692 17951770 3.6% monotonic-coarse 43624027 44215292 1.3% monotonic-raw 17541809 17554932 0.1% boottime 17334982 17954361 3.5% [ tglx: Avoid the goto ] Signed-off-by: Andrei Vagin Signed-off-by: Dmitry Safonov Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20191112012724.250792-3-dima@arista.com Signed-off-by: Sasha Levin --- lib/vdso/gettimeofday.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index c549e72758aa0..5667fb746a1fe 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -38,7 +38,7 @@ u64 vdso_calc_delta(u64 cycles, u64 last, u64 mask, u32 mult) } #endif -static int do_hres(const struct vdso_data *vd, clockid_t clk, +static __always_inline int do_hres(const struct vdso_data *vd, clockid_t clk, struct __kernel_timespec *ts) { const struct vdso_timestamp *vdso_ts = &vd->basetime[clk]; @@ -68,8 +68,8 @@ static int do_hres(const struct vdso_data *vd, clockid_t clk, return 0; } -static int do_coarse(const struct vdso_data *vd, clockid_t clk, - struct __kernel_timespec *ts) +static __always_inline int do_coarse(const struct vdso_data *vd, clockid_t clk, + struct __kernel_timespec *ts) { const struct vdso_timestamp *vdso_ts = &vd->basetime[clk]; u32 seq; @@ -99,13 +99,15 @@ __cvdso_clock_gettime_common(clockid_t clock, struct __kernel_timespec *ts) */ msk = 1U << clock; if (likely(msk & VDSO_HRES)) - return do_hres(&vd[CS_HRES_COARSE], clock, ts); + vd = &vd[CS_HRES_COARSE]; else if (msk & VDSO_COARSE) return do_coarse(&vd[CS_HRES_COARSE], clock, ts); else if (msk & VDSO_RAW) - return do_hres(&vd[CS_RAW], clock, ts); + vd = &vd[CS_RAW]; + else + return -1; - return -1; + return do_hres(vd, clock, ts); } static __maybe_unused int -- 2.35.1