[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-447976ef4fd09b1be88b316d1a81553f1aa7cd07@git.kernel.org>
Date: Fri, 30 Sep 2016 05:06:19 -0700
From: tip-bot for Frederic Weisbecker <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: hpa@...or.com, pbonzini@...hat.com, wanpeng.li@...mail.com,
mingo@...nel.org, torvalds@...ux-foundation.org,
tglx@...utronix.de, linux-kernel@...r.kernel.org,
eric.dumazet@...il.com, efault@....de, fweisbec@...il.com,
riel@...hat.com, peterz@...radead.org
Subject: [tip:sched/core] sched/irqtime: Consolidate irqtime flushing code
Commit-ID: 447976ef4fd09b1be88b316d1a81553f1aa7cd07
Gitweb: http://git.kernel.org/tip/447976ef4fd09b1be88b316d1a81553f1aa7cd07
Author: Frederic Weisbecker <fweisbec@...il.com>
AuthorDate: Mon, 26 Sep 2016 02:29:21 +0200
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 30 Sep 2016 11:46:41 +0200
sched/irqtime: Consolidate irqtime flushing code
The code performing irqtime nsecs stats flushing to kcpustat is roughly
the same for hardirq and softirq. So lets consolidate that common code.
Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
Reviewed-by: Rik van Riel <riel@...hat.com>
Cc: Eric Dumazet <eric.dumazet@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Mike Galbraith <efault@....de>
Cc: Paolo Bonzini <pbonzini@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Wanpeng Li <wanpeng.li@...mail.com>
Link: http://lkml.kernel.org/r/1474849761-12678-6-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
kernel/sched/cputime.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index 1cea2f1..5ebee31 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -70,32 +70,28 @@ void irqtime_account_irq(struct task_struct *curr)
}
EXPORT_SYMBOL_GPL(irqtime_account_irq);
-static cputime_t irqtime_account_hi_update(cputime_t maxtime)
+static cputime_t irqtime_account_update(u64 irqtime, int idx, cputime_t maxtime)
{
u64 *cpustat = kcpustat_this_cpu->cpustat;
cputime_t irq_cputime;
- u64 nsecs;
- nsecs = __this_cpu_read(cpu_irqtime.hardirq_time);
- irq_cputime = nsecs_to_cputime64(nsecs) - cpustat[CPUTIME_IRQ];
+ irq_cputime = nsecs_to_cputime64(irqtime) - cpustat[idx];
irq_cputime = min(irq_cputime, maxtime);
- cpustat[CPUTIME_IRQ] += irq_cputime;
+ cpustat[idx] += irq_cputime;
return irq_cputime;
}
-static cputime_t irqtime_account_si_update(cputime_t maxtime)
+static cputime_t irqtime_account_hi_update(cputime_t maxtime)
{
- u64 *cpustat = kcpustat_this_cpu->cpustat;
- cputime_t softirq_cputime;
- u64 nsecs;
-
- nsecs = __this_cpu_read(cpu_irqtime.softirq_time);
- softirq_cputime = nsecs_to_cputime64(nsecs) - cpustat[CPUTIME_SOFTIRQ];
- softirq_cputime = min(softirq_cputime, maxtime);
- cpustat[CPUTIME_SOFTIRQ] += softirq_cputime;
+ return irqtime_account_update(__this_cpu_read(cpu_irqtime.hardirq_time),
+ CPUTIME_IRQ, maxtime);
+}
- return softirq_cputime;
+static cputime_t irqtime_account_si_update(cputime_t maxtime)
+{
+ return irqtime_account_update(__this_cpu_read(cpu_irqtime.softirq_time),
+ CPUTIME_SOFTIRQ, maxtime);
}
#else /* CONFIG_IRQ_TIME_ACCOUNTING */
Powered by blists - more mailing lists