mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: riel@redhat.com
To: linux-kernel@vger.kernel.org
Cc: fweisbec@redhat.com, peterz@infradead.org, mingo@kernel.org,
	tglx@linutronix.de, luto@amacapital.net
Subject: [RFC PATCH 03/11] time,nohz: add cpu parameter to irqtime_account_process_tick
Date: Wed, 24 Jun 2015 10:57:52 -0400	[thread overview]
Message-ID: <1435157880-22925-4-git-send-email-riel@redhat.com> (raw)
In-Reply-To: <1435157880-22925-1-git-send-email-riel@redhat.com>

From: Rik van Riel <riel@redhat.com>

Add a cpu parameter to irqtime_account_process_tick, to specify what
cpu to run the statistics for.

In order for this to actually work on a different cpu, all the functions
called by irqtime_account_process_tick need to be able to handle workng
for another CPU.

Signed-off-by: Rik van Riel <riel@redhat.com>
---
 kernel/sched/cputime.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index 84b2d24a2238..7df761cd6dfc 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -336,12 +336,14 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times)
  * p->stime and friends are only updated on system time and not on irq
  * softirq as those do not count in task exec_runtime any more.
  */
-static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
+static void irqtime_account_process_tick(struct task_struct *p, int cpu,
+					 int user_tick,
 					 struct rq *rq, int ticks)
 {
 	cputime_t scaled = cputime_to_scaled(cputime_one_jiffy);
+	struct kernel_cpustat *kstat = &kcpustat_cpu(cpu);
 	u64 cputime = (__force u64) cputime_one_jiffy;
-	u64 *cpustat = kcpustat_this_cpu->cpustat;
+	u64 *cpustat = kstat->cpustat;
 
 	if (steal_account_process_tick())
 		return;
@@ -374,12 +376,14 @@ static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
 static void irqtime_account_idle_ticks(int ticks)
 {
 	struct rq *rq = this_rq();
+	int cpu = smp_processor_id();
 
-	irqtime_account_process_tick(current, 0, rq, ticks);
+	irqtime_account_process_tick(current, cpu, 0, rq, ticks);
 }
 #else /* CONFIG_IRQ_TIME_ACCOUNTING */
 static inline void irqtime_account_idle_ticks(int ticks) {}
-static inline void irqtime_account_process_tick(struct task_struct *p, int user_tick,
+static inline void irqtime_account_process_tick(struct task_struct *p, int cpu,
+						int user_tick,
 						struct rq *rq, int nr_ticks) {}
 #endif /* CONFIG_IRQ_TIME_ACCOUNTING */
 
@@ -475,7 +479,7 @@ void account_process_tick(struct task_struct *p, int user_tick)
 		return;
 
 	if (sched_clock_irqtime) {
-		irqtime_account_process_tick(p, user_tick, rq, 1);
+		irqtime_account_process_tick(p, cpu, user_tick, rq, 1);
 		return;
 	}
 
-- 
2.1.0


  parent reply	other threads:[~2015-06-24 14:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24 14:57 [RFC INCOMPLETE] tick based timekeeping from a housekeeping CPU riel
2015-06-24 14:57 ` [RFC PATCH 01/11] nohz,time: make account_process_tick work on the task's CPU riel
2015-06-24 14:57 ` [RFC PATCH 02/11] time,nohz: rename vtime_accounting_enabled to tick_accounting_disabled riel
2015-06-24 14:57 ` riel [this message]
2015-06-24 14:57 ` [RFC PATCH 04/11] time,nohz: add cpu parameter to steal_account_process_tick riel
2015-06-24 14:57 ` [RFC PATCH 05/11] time,nohz: add cpu parameter to account_steal_time riel
2015-06-24 14:57 ` [RFC PATCH 06/11] time,nohz: add cpu parameter to account_idle_time riel
2015-06-24 14:57 ` [RFC PATCH 07/11] nohz,timer: designate timer housekeeping cpu riel
2015-06-24 14:57 ` [RFC PATCH 08/11] nohz,timer: have housekeeper call account_process_tick for nohz cpus riel
2015-06-30 14:23   ` Frederic Weisbecker
2015-06-24 14:57 ` [RFC PATCH 09/11] nohz,time: add tick_accounting_remote macro riel
2015-06-24 14:57 ` [RFC PATCH 10/11] nohz,kvm,time: skip vtime accounting at kernel entry & exit riel
2015-06-24 15:08   ` Andy Lutomirski
2015-06-24 14:58 ` [RFC PATCH 11/11] nohz,kvm,time: teach account_process_tick about guest time riel
2015-06-24 15:06   ` Andy Lutomirski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435157880-22925-4-git-send-email-riel@redhat.com \
    --to=riel@redhat.com \
    --cc=fweisbec@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®