From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E6B1C433ED for ; Mon, 12 Apr 2021 12:55:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 386C261246 for ; Mon, 12 Apr 2021 12:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240400AbhDLMzW (ORCPT ); Mon, 12 Apr 2021 08:55:22 -0400 Received: from foss.arm.com ([217.140.110.172]:49950 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240333AbhDLMzV (ORCPT ); Mon, 12 Apr 2021 08:55:21 -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 82EA51FB; Mon, 12 Apr 2021 05:55:03 -0700 (PDT) Received: from [10.37.12.6] (unknown [10.37.12.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0E9C53F73B; Mon, 12 Apr 2021 05:55:00 -0700 (PDT) Subject: Re: [PATCH RESEND v1 1/4] lib/vdso: Mark do_hres_timens() and do_coarse_timens() __always_inline() To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, dima@arista.com, avagin@gmail.com, arnd@arndb.de, tglx@linutronix.de, luto@kernel.org, linux-arch@vger.kernel.org References: <90dcf45ebadfd5a07f24241551c62f619d1cb930.1617209142.git.christophe.leroy@csgroup.eu> From: Vincenzo Frascino Message-ID: <8b42e769-2f17-e2b4-4d2a-b86c4e412598@arm.com> Date: Mon, 12 Apr 2021 13:54:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <90dcf45ebadfd5a07f24241551c62f619d1cb930.1617209142.git.christophe.leroy@csgroup.eu> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On 3/31/21 5:48 PM, Christophe Leroy wrote: > In the same spirit as commit c966533f8c6c ("lib/vdso: Mark do_hres() > and do_coarse() as __always_inline"), mark do_hres_timens() and > do_coarse_timens() __always_inline. > > The measurement below in on a non timens process, ie on the fastest path. > > On powerpc32, without the patch: > > clock-gettime-monotonic-raw: vdso: 1155 nsec/call > clock-gettime-monotonic-coarse: vdso: 813 nsec/call > clock-gettime-monotonic: vdso: 1076 nsec/call > > With the patch: > > clock-gettime-monotonic-raw: vdso: 1100 nsec/call > clock-gettime-monotonic-coarse: vdso: 667 nsec/call > clock-gettime-monotonic: vdso: 1025 nsec/call > > Signed-off-by: Christophe Leroy Reviewed-by: Vincenzo Frascino > --- > lib/vdso/gettimeofday.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c > index 2919f1698140..c6f6dee08746 100644 > --- a/lib/vdso/gettimeofday.c > +++ b/lib/vdso/gettimeofday.c > @@ -46,8 +46,8 @@ static inline bool vdso_cycles_ok(u64 cycles) > #endif > > #ifdef CONFIG_TIME_NS > -static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk, > - struct __kernel_timespec *ts) > +static __always_inline int do_hres_timens(const struct vdso_data *vdns, clockid_t clk, > + struct __kernel_timespec *ts) > { > const struct vdso_data *vd = __arch_get_timens_vdso_data(); > const struct timens_offset *offs = &vdns->offset[clk]; > @@ -97,8 +97,8 @@ static __always_inline const struct vdso_data *__arch_get_timens_vdso_data(void) > return NULL; > } > > -static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk, > - struct __kernel_timespec *ts) > +static __always_inline int do_hres_timens(const struct vdso_data *vdns, clockid_t clk, > + struct __kernel_timespec *ts) > { > return -EINVAL; > } > @@ -159,8 +159,8 @@ static __always_inline int do_hres(const struct vdso_data *vd, clockid_t clk, > } > > #ifdef CONFIG_TIME_NS > -static int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk, > - struct __kernel_timespec *ts) > +static __always_inline int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk, > + struct __kernel_timespec *ts) > { > const struct vdso_data *vd = __arch_get_timens_vdso_data(); > const struct vdso_timestamp *vdso_ts = &vd->basetime[clk]; > @@ -188,8 +188,8 @@ static int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk, > return 0; > } > #else > -static int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk, > - struct __kernel_timespec *ts) > +static __always_inline int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk, > + struct __kernel_timespec *ts) > { > return -1; > } > -- Regards, Vincenzo