lkml.org 
[lkml]   [2018]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] kernel/sched: declare account_system_time() static
Date
account_system_time() is used only from one file, and only
when CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is not selected

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
include/linux/kernel_stat.h | 1 -
kernel/sched/cputime.c | 50 ++++++++++++++++++++++-----------------------
2 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 7ee2bb43b251..051b53055d5d 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -80,7 +80,6 @@ static inline unsigned int kstat_cpu_irqs_sum(unsigned int cpu)

extern void account_user_time(struct task_struct *, u64);
extern void account_guest_time(struct task_struct *, u64);
-extern void account_system_time(struct task_struct *, int, u64);
extern void account_system_index_time(struct task_struct *, u64,
enum cpu_usage_stat);
extern void account_steal_time(u64);
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index 0796f938c4f0..0ccf4865df35 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -175,31 +175,6 @@ void account_system_index_time(struct task_struct *p,
}

/*
- * Account system CPU time to a process.
- * @p: the process that the CPU time gets accounted to
- * @hardirq_offset: the offset to subtract from hardirq_count()
- * @cputime: the CPU time spent in kernel space since the last update
- */
-void account_system_time(struct task_struct *p, int hardirq_offset, u64 cputime)
-{
- int index;
-
- if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) {
- account_guest_time(p, cputime);
- return;
- }
-
- if (hardirq_count() - hardirq_offset)
- index = CPUTIME_IRQ;
- else if (in_serving_softirq())
- index = CPUTIME_SOFTIRQ;
- else
- index = CPUTIME_SYSTEM;
-
- account_system_index_time(p, cputime, index);
-}
-
-/*
* Account for involuntary wait time.
* @cputime: the CPU time spent in involuntary wait
*/
@@ -467,6 +442,31 @@ void thread_group_cputime_adjusted(struct task_struct *p, u64 *ut, u64 *st)
#else /* !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE: */

/*
+ * Account system CPU time to a process.
+ * @p: the process that the CPU time gets accounted to
+ * @hardirq_offset: the offset to subtract from hardirq_count()
+ * @cputime: the CPU time spent in kernel space since the last update
+ */
+static void account_system_time(struct task_struct *p, int hardirq_offset, u64 cputime)
+{
+ int index;
+
+ if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) {
+ account_guest_time(p, cputime);
+ return;
+ }
+
+ if (hardirq_count() - hardirq_offset)
+ index = CPUTIME_IRQ;
+ else if (in_serving_softirq())
+ index = CPUTIME_SOFTIRQ;
+ else
+ index = CPUTIME_SYSTEM;
+
+ account_system_index_time(p, cputime, index);
+}
+
+/*
* Account a single tick of CPU time.
* @p: the process that the CPU time gets accounted to
* @user_tick: indicates if the tick is a user or a system tick
--
2.13.3
\
 
 \ /
  Last update: 2018-04-17 17:58    [W:0.022 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site