Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6476590ybl; Mon, 23 Dec 2019 06:32:23 -0800 (PST) X-Google-Smtp-Source: APXvYqyxj1MNaZzSsj2QZcyvahe4mEY2ypzKZ8TdATdNs4KOT3bxm9IcWdf/+gx24i1+BnWdPybz X-Received: by 2002:a05:6808:9ba:: with SMTP id e26mr6034937oig.81.1577111543346; Mon, 23 Dec 2019 06:32:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577111543; cv=none; d=google.com; s=arc-20160816; b=dsd5QSv5SU0ILRJJpcKHnbEi6kABWrN5HPDCk4pR8+kXStpWvH0KeJLiH66tcqzWhd CtSIvCbUOqeX4E6zh8/aUfv9ae78F/aMg1QRO5PddQwo8SBPoJjPlb5myQIteu/LIoDj x9cqaONnw6q1+tFQb/JDibbYBs3UxMimiYHbEg8GE7GS7e/CsDr8/ssQg5gxt+huJlJz Q+3DDYEL7FSFUZA1wDTRw7ViKrc2MDtaWeS878Vc3H3WNIi0i4BHKe97KvOO5+aq8AZo ySbVPI7RnPxZ13nHdCQeP5VFJBRmR52fPmrPnd7JBxbb//zknAYWkMNZ7/bIC80DXSmp jTPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=4HlVdfb/m2bnebYsqTVj7kFlC+Ng414ig/AZSZp6k7s=; b=HHkVMnIxa0E7Ry3xfUdpFNFzu6HteXxZcQR3ClhajPvr770n7TPXhN2dFrz5nGnhi2 cSM7KO29xuS6j2z8yQpEuD4cPYWXQ4X0/7SyoT5p5wSEMUJZIyovR/yOp+K04kec+ubh ORNNCu0JYiXCT/7fN26g9vT4lbLZSrVnHzkXnfABkOZQNge8yENoeBWIrkGKsT5FOpmp o9u15KJnZ89nRtg0XGcqGCZDghQlrP2Z6hq94Lv4dRr6INl8bkINmlhohZRb5IoiLxtV Pbh6d16YPhq/rsyKq+/gXUnUpXwyMYPE7wmLvdfKbPyhoCDrUHTs5XI3gW+0+s5EXcT8 Ytrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=WqRlriy0; 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 z62si9716170oiz.271.2019.12.23.06.32.10; Mon, 23 Dec 2019 06:32:23 -0800 (PST) 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; dkim=pass header.i=@c-s.fr header.s=mail header.b=WqRlriy0; 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 S1727166AbfLWObP (ORCPT + 99 others); Mon, 23 Dec 2019 09:31:15 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:14019 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726884AbfLWObI (ORCPT ); Mon, 23 Dec 2019 09:31:08 -0500 Received: from localhost (mailhub1-ext [192.168.12.233]) by localhost (Postfix) with ESMTP id 47hMGY4PS8z9txhl; Mon, 23 Dec 2019 15:31:01 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=WqRlriy0; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id lyyav2mt8lCR; Mon, 23 Dec 2019 15:31:01 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 47hMGY3DMLz9txhg; Mon, 23 Dec 2019 15:31:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1577111461; bh=4HlVdfb/m2bnebYsqTVj7kFlC+Ng414ig/AZSZp6k7s=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=WqRlriy0DqcZh60SDjoGMQijbqFO68IO3uompTe3PTUn5JPopZMKehw9+2nPSPIZP hwfYncZjR/MLSaTvHfyl3A0w9elV2k2/xL/eg8+TK6KKCyFx1bzcUuK7n2o2YsIyfr HAsfky9f/aUORYv0A9P41kc9Lg3ATeICFVaYId54= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 8959D8B7AB; Mon, 23 Dec 2019 15:31:06 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id pPU4VC3HWwT0; Mon, 23 Dec 2019 15:31:06 +0100 (CET) Received: from po16098vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.100]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5CBAE8B7A1; Mon, 23 Dec 2019 15:31:06 +0100 (CET) Received: by po16098vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 66892637D4; Mon, 23 Dec 2019 14:31:06 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [RFC PATCH v2 05/10] lib: vdso: inline do_hres() To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , arnd@arndb.de, tglx@linutronix.de, vincenzo.frascino@arm.com, luto@kernel.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, x86@kernel.org Date: Mon, 23 Dec 2019 14:31:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org do_hres() is called from several places, so GCC doesn't inline it at first. do_hres() takes a struct __kernel_timespec * parameter for passing the result. In the 32 bits case, this parameter corresponds to a local var in the caller. In order to provide a pointer to this structure, the caller has to put it in its stack and do_hres() has to write the result in the stack. This is suboptimal, especially on RISC processor like powerpc. By making GCC inline the function, the struct __kernel_timespec remains a local var using registers, avoiding the need to write and read stack. The improvement is significant on powerpc. Signed-off-by: Christophe Leroy --- lib/vdso/gettimeofday.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index 24e1ba838260..86d5b1c8796b 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -34,8 +34,8 @@ 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, - struct __kernel_timespec *ts) +static 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]; u64 cycles, last, sec, ns; -- 2.13.3