From: Venkatesh Pallipadi <venki@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
Balbir Singh <balbir@linux.vnet.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: linux-kernel@vger.kernel.org, Paul Turner <pjt@google.com>,
Eric Dumazet <eric.dumazet@gmail.com>,
Shaun Ruffell <sruffell@digium.com>,
Yong Zhang <yong.zhang0@gmail.com>,
Venkatesh Pallipadi <venki@google.com>
Subject: [PATCH 2/6] cleanup account_system_vtime with this_cpu_* -v1
Date: Mon, 25 Oct 2010 15:30:13 -0700 [thread overview]
Message-ID: <1288045817-3135-3-git-send-email-venki@google.com> (raw)
In-Reply-To: <1288045817-3135-1-git-send-email-venki@google.com>
this_cpu_* variants are optimal than per_cpu(). Cleanup
IRQ_TIME_ACCOUNTING account_system_vtime to use this_cpu_*.
Signed-off-by: Venkatesh Pallipadi <venki@google.com>
---
kernel/sched.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index fae668b..a37bb83 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1966,7 +1966,6 @@ static u64 irq_time_cpu(int cpu)
void account_system_vtime(struct task_struct *curr)
{
unsigned long flags;
- int cpu;
u64 now, delta;
if (!sched_clock_irqtime)
@@ -1974,20 +1973,19 @@ void account_system_vtime(struct task_struct *curr)
local_irq_save(flags);
- cpu = smp_processor_id();
- now = sched_clock_cpu(cpu);
- delta = now - per_cpu(irq_start_time, cpu);
- per_cpu(irq_start_time, cpu) = now;
+ now = sched_clock_cpu(smp_processor_id());
+ delta = now - this_cpu_read(irq_start_time);
+ this_cpu_write(irq_start_time, now);
/*
* We do not account for softirq time from ksoftirqd here.
* We want to continue accounting softirq time to ksoftirqd thread
* in that case, so as not to confuse scheduler with a special task
* that do not consume any time, but still wants to run.
*/
- if (hardirq_count())
- per_cpu(cpu_hardirq_time, cpu) += delta;
+ if (in_irq())
+ this_cpu_add(cpu_hardirq_time, delta);
else if (in_serving_softirq() && curr != this_cpu_ksoftirqd())
- per_cpu(cpu_softirq_time, cpu) += delta;
+ this_cpu_add(cpu_softirq_time, delta);
local_irq_restore(flags);
}
--
1.7.1
next prev parent reply other threads:[~2010-10-25 22:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-25 22:30 [PATCH 0/6] Proper kernel irq time reporting -v1 Venkatesh Pallipadi
2010-10-25 22:30 ` [PATCH 1/6] Free up pf flag PF_KSOFTIRQD -v1 Venkatesh Pallipadi
2010-10-25 22:30 ` Venkatesh Pallipadi [this message]
2010-10-25 22:30 ` [PATCH 3/6] Add nsecs_to_cputime64 interface for asm-generic -v1 Venkatesh Pallipadi
2010-10-25 22:30 ` [PATCH 4/6] Refactor account_system_time separating id-update -v1 Venkatesh Pallipadi
2010-10-25 22:30 ` [PATCH 5/6] Export ns irqtimes through /proc/stat -v1 Venkatesh Pallipadi
2010-10-26 9:45 ` Peter Zijlstra
2010-10-26 14:57 ` Peter Zijlstra
2010-10-26 17:35 ` Venkatesh Pallipadi
2010-10-25 22:30 ` [PATCH 6/6] Account ksoftirqd time as cpustat softirq -v1 Venkatesh Pallipadi
2010-10-26 9:33 ` Peter Zijlstra
2010-10-26 9:50 ` Peter Zijlstra
2010-10-26 17:35 ` Venkatesh Pallipadi
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=1288045817-3135-3-git-send-email-venki@google.com \
--to=venki@google.com \
--cc=balbir@linux.vnet.ibm.com \
--cc=eric.dumazet@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=schwidefsky@de.ibm.com \
--cc=sruffell@digium.com \
--cc=tglx@linutronix.de \
--cc=yong.zhang0@gmail.com \
/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®