Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3565282imm; Tue, 29 May 2018 09:20:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoSZQTBAJDcBnu8Gdgs5hA7eiBcNJgUiKNT6j5aen1dfRcFGlRdo3vKw5UBcQJeKmbTNiQu X-Received: by 2002:a17:902:1c8:: with SMTP id b66-v6mr17772882plb.156.1527610820378; Tue, 29 May 2018 09:20:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527610820; cv=none; d=google.com; s=arc-20160816; b=klLpYIF3/wkZ+ioyycUXjc7dfsmlgUGFV1mS5YKkFukgHcxyhXmUCKs2sjK68X7Whc xnjCxm8L5orzj7Ko/qPb4iIhYB7OWbIlLfVePXGPngnVhfFuaJkSE6v8DuuL2uSB0Xet 9+Mu4xxTVfF1THFVEL3p9CD+zgPIcv9XjaK93Hm/tbH/FZxqpCjxvkcA8nsXC59+UGqu FZA3LNmeZxV47BrmB/DIbo71phXNjSmuSc4CItv2f6iLQ3Etd9hL7d66XXv/1Z/TOO+e jKLO1PW4/hs5elawPvTVRFuxWwC/dNA6wo38N5dpfI56Acsm3nwsyACMm5wy6qRX7FP8 N/mA== 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:message-id :arc-authentication-results; bh=mgYQr7LCTsDSuE5NT3Ov8wEFMqetlMt5+lifj5gaaY4=; b=ONevD+9fml79lr4d02wtuTcZZJaoS4+K4hk/WFNqYA0bjUytjOXbruZZCo75d4MigQ aHekZ2ra6Y8n212Fpf1zNHsH5eG85qJvian+QwmCyJNKuDjcvDUN+hZap5+R5ocRY6qZ cO9tY5hrS/Nq27bEkbI1IpUqUOcB1DqMx4ufjK6j7JMZb0VYeCpfMeYbhoO/dOF+X8qu BJUDgqQC+Lxd7XNE0vY25vHXNgmY55B8TJv3HugAKYi+0SO9+XFlQlJSnCbUVF5U0LVl mlfK4W9+sTI1MZwYer40OeNWO8D+tv3u69p//vwH4hoOYmSWHvNlKEq565iOW95g5yAm wIwA== 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 s7-v6si25287216pgr.670.2018.05.29.09.20.06; Tue, 29 May 2018 09:20:20 -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 S936465AbeE2QTR (ORCPT + 99 others); Tue, 29 May 2018 12:19:17 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:44023 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934877AbeE2QTQ (ORCPT ); Tue, 29 May 2018 12:19:16 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 40wJns19l4z9tvrv; Tue, 29 May 2018 18:19:13 +0200 (CEST) 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 w_p6EwLpGHbc; Tue, 29 May 2018 18:19:13 +0200 (CEST) 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 40wJns0cv6z9tvrn; Tue, 29 May 2018 18:19:13 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C4F178BB36; Tue, 29 May 2018 18:19:14 +0200 (CEST) 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 w3ntmpNa6hSt; Tue, 29 May 2018 18:19:14 +0200 (CEST) Received: from po14934vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.2]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A678F8BB34; Tue, 29 May 2018 18:19:14 +0200 (CEST) Received: by po14934vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 8B5696F515; Tue, 29 May 2018 16:19:14 +0000 (UTC) Message-Id: <2e937890abac10677aae3c1e345dd934a6794c37.1527610536.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH v3 1/3] powerpc/time: inline arch_vtime_task_switch() To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 29 May 2018 16:19:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org arch_vtime_task_switch() is a small function which is called only from vtime_common_task_switch(), so it is worth inlining Signed-off-by: Christophe Leroy --- v3: no change v2: added a local pointer for get_accounting(prev) to avoid GCC to read it twice arch/powerpc/include/asm/cputime.h | 16 +++++++++++++++- arch/powerpc/kernel/time.c | 21 --------------------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h index 99b541865d8d..bc4903badb3f 100644 --- a/arch/powerpc/include/asm/cputime.h +++ b/arch/powerpc/include/asm/cputime.h @@ -47,9 +47,23 @@ static inline unsigned long cputime_to_usecs(const cputime_t ct) * has to be populated in the new task */ #ifdef CONFIG_PPC64 +#define get_accounting(tsk) (&get_paca()->accounting) static inline void arch_vtime_task_switch(struct task_struct *tsk) { } #else -void arch_vtime_task_switch(struct task_struct *tsk); +#define get_accounting(tsk) (&task_thread_info(tsk)->accounting) +/* + * Called from the context switch with interrupts disabled, to charge all + * accumulated times to the current process, and to prepare accounting on + * the next process. + */ +static inline void arch_vtime_task_switch(struct task_struct *prev) +{ + struct cpu_accounting_data *acct = get_accounting(current); + struct cpu_accounting_data *acct0 = get_accounting(prev); + + acct->starttime = acct0->starttime; + acct->startspurr = acct0->startspurr; +} #endif #endif /* __KERNEL__ */ diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 360e71d455cc..a3ed2eb99d88 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -163,12 +163,6 @@ EXPORT_SYMBOL(__cputime_usec_factor); void (*dtl_consumer)(struct dtl_entry *, u64); #endif -#ifdef CONFIG_PPC64 -#define get_accounting(tsk) (&get_paca()->accounting) -#else -#define get_accounting(tsk) (&task_thread_info(tsk)->accounting) -#endif - static void calc_cputime_factors(void) { struct div_result res; @@ -421,21 +415,6 @@ void vtime_flush(struct task_struct *tsk) acct->softirq_time = 0; } -#ifdef CONFIG_PPC32 -/* - * Called from the context switch with interrupts disabled, to charge all - * accumulated times to the current process, and to prepare accounting on - * the next process. - */ -void arch_vtime_task_switch(struct task_struct *prev) -{ - struct cpu_accounting_data *acct = get_accounting(current); - - acct->starttime = get_accounting(prev)->starttime; - acct->startspurr = get_accounting(prev)->startspurr; -} -#endif /* CONFIG_PPC32 */ - #else /* ! CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ #define calc_cputime_factors() #endif -- 2.13.3