From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
To: linux-ia64@vger.kernel.org
Subject: [PATCH 4/9] ia64: VIRT_CPU_ACCOUNTING (accurate cpu time accounting)
Date: Tue, 16 Oct 2007 13:37:46 +0000 [thread overview]
Message-ID: <4714BEAA.5050008@jp.fujitsu.com> (raw)
> [4/9] ia64_self_update_process_times.patch
Next, we need to stop sampling in timer interrupt which
used for tick-based cpu time accounting.
Now the stime/utime of threads are updated in a function
update_process_times(), that is called from timer_interrupt().
[arch/ia64/kernel/time.c]
46 static irqreturn_t
47 timer_interrupt (int irq, void *dev_id)
48 {
:
65 while (1) {
66 update_process_times(user_mode(get_irq_regs()));
:
70 if (smp_processor_id() = time_keeper_id) {
:
78 do_timer(1);
:
84 if (time_after(new_itm, ia64_get_itc()))
85 break;
:
92 }
This update_process_times() is defined in kernel/timer.c.
Therefore, I copied this function into ia64 region to ready to
modify it as we like.
This patch just do copy. Later change will be done.
Thanks,
H.Seto
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
---
arch/ia64/kernel/time.c | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletion(-)
Index: linux-2.6.23/arch/ia64/kernel/time.c
=================================--- linux-2.6.23.orig/arch/ia64/kernel/time.c
+++ linux-2.6.23/arch/ia64/kernel/time.c
@@ -61,6 +61,9 @@
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
+#include <linux/kernel_stat.h>
+#include <linux/posix-timers.h>
+
/*
* Account time for a transition between system, hard irq
* or soft irq state.
@@ -70,6 +73,31 @@
}
+/*
+ * Called from the timer interrupt handler to charge one tick to the current
+ * process. user_tick is 1 if the tick is user time, 0 for system.
+ */
+static inline void ia64_update_process_times(int user_tick)
+{
+ struct task_struct *p = current;
+ int cpu = smp_processor_id();
+
+ /* Note: this timer irq context must be accounted for as well. */
+ if (user_tick)
+ account_user_time(p, jiffies_to_cputime(1));
+ else
+ account_system_time(p, HARDIRQ_OFFSET, jiffies_to_cputime(1));
+ run_local_timers();
+ if (rcu_pending(cpu))
+ rcu_check_callbacks(cpu, user_tick);
+ scheduler_tick();
+ run_posix_cpu_timers(p);
+}
+
+#else /* CONFIG_VIRT_CPU_ACCOUNTING */
+
+#define ia64_update_process_times(utick) update_process_times(utick)
+
#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
static irqreturn_t
@@ -92,7 +120,7 @@
profile_tick(CPU_PROFILING);
while (1) {
- update_process_times(user_mode(get_irq_regs()));
+ ia64_update_process_times(user_mode(get_irq_regs()));
new_itm += local_cpu_data->itm_delta;
reply other threads:[~2007-10-16 13:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4714BEAA.5050008@jp.fujitsu.com \
--to=seto.hidetoshi@jp.fujitsu.com \
--cc=linux-ia64@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.