powerpc/time: inline arch_vtime_task_switch()
authorChristophe Leroy <christophe.leroy@c-s.fr>
Tue, 29 May 2018 16:19:14 +0000 (16:19 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 3 Jun 2018 14:39:20 +0000 (00:39 +1000)
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 <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/cputime.h
arch/powerpc/kernel/time.c

index 99b541865d8dd65cb420e25eae476b2ec6d71632..bc4903badb3ff4e7d158e280a30cd84bbaa56fe2 100644 (file)
@@ -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__ */
index 2530cf60b839289d24c23c9d784e200e21dce2e1..70f145e0248776d6692439d60e4fe6f10097abc0 100644 (file)
@@ -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