From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Subject: [patch 9/9] Scheduler profiling - Use conditional calls
Date: Tue, 29 May 2007 14:34:05 -0400 [thread overview]
Message-ID: <20070529183710.683711996@polymtl.ca> (raw)
In-Reply-To: 20070529183356.192838687@polymtl.ca
[-- Attachment #1: profiling-use-cond-calls.patch --]
[-- Type: text/plain, Size: 3195 bytes --]
Use conditional calls with lower d-cache hit in optimized version as a
condition for scheduler profiling call.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
kernel/profile.c | 4 ++++
kernel/sched.c | 32 +++++++++++++++++++-------------
2 files changed, 23 insertions(+), 13 deletions(-)
Index: linux-2.6-lttng/kernel/profile.c
===================================================================
--- linux-2.6-lttng.orig/kernel/profile.c 2007-05-29 11:33:11.000000000 -0400
+++ linux-2.6-lttng/kernel/profile.c 2007-05-29 11:37:46.000000000 -0400
@@ -23,6 +23,7 @@
#include <linux/profile.h>
#include <linux/highmem.h>
#include <linux/mutex.h>
+#include <linux/condcall.h>
#include <asm/sections.h>
#include <asm/semaphore.h>
#include <asm/irq_regs.h>
@@ -91,6 +92,8 @@
printk(KERN_INFO "kernel profiling enabled (shift: %ld)\n",
prof_shift);
}
+ if (prof_on)
+ BUG_ON(cond_call_arm("profile_on"));
return 1;
}
__setup("profile=", profile_setup);
@@ -555,6 +558,7 @@
return 0;
out_cleanup:
prof_on = 0;
+ cond_call_disarm("profile_on");
smp_mb();
on_each_cpu(profile_nop, NULL, 0, 1);
for_each_online_cpu(cpu) {
Index: linux-2.6-lttng/kernel/sched.c
===================================================================
--- linux-2.6-lttng.orig/kernel/sched.c 2007-05-29 11:38:06.000000000 -0400
+++ linux-2.6-lttng/kernel/sched.c 2007-05-29 11:42:36.000000000 -0400
@@ -54,6 +54,7 @@
#include <linux/kprobes.h>
#include <linux/delayacct.h>
#include <linux/reciprocal_div.h>
+#include <linux/condcall.h>
#include <asm/tlb.h>
#include <asm/unistd.h>
@@ -972,6 +973,21 @@
}
/*
+ * Sleep time is in units of nanosecs, so shift by 20 to get a
+ * milliseconds-range estimation of the amount of time that the task
+ * spent sleeping:
+ */
+static inline void activate_task_prof(struct task_struct *p,
+ unsigned long long now)
+{
+ if (unlikely(prof_on == SLEEP_PROFILING)) {
+ if (p->state == TASK_UNINTERRUPTIBLE)
+ profile_hits(SLEEP_PROFILING, (void *)get_wchan(p),
+ (now - p->timestamp) >> 20);
+ }
+}
+
+/*
* activate_task - move a task to the runqueue and do priority recalculation
*
* Update all the scheduling statistics stuff. (sleep average
@@ -993,18 +1009,7 @@
+ rq->most_recent_timestamp;
}
#endif
-
- /*
- * Sleep time is in units of nanosecs, so shift by 20 to get a
- * milliseconds-range estimation of the amount of time that the task
- * spent sleeping:
- */
- if (unlikely(prof_on == SLEEP_PROFILING)) {
- if (p->state == TASK_UNINTERRUPTIBLE)
- profile_hits(SLEEP_PROFILING, (void *)get_wchan(p),
- (now - p->timestamp) >> 20);
- }
-
+ cond_call(profile_on, activate_task_prof(p, now));
p->prio = recalc_task_prio(p, now);
/*
@@ -3534,7 +3539,8 @@
print_irqtrace_events(current);
dump_stack();
}
- profile_hit(SCHED_PROFILING, __builtin_return_address(0));
+ cond_call(profile_on,
+ profile_hit(SCHED_PROFILING, __builtin_return_address(0)));
need_resched:
preempt_disable();
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
next prev parent reply other threads:[~2007-05-29 18:40 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-29 18:33 [patch 0/9] Conditional Calls Mathieu Desnoyers
2007-05-29 18:33 ` [patch 1/9] Conditional Calls - Architecture Independent Code Mathieu Desnoyers
2007-05-29 18:33 ` [patch 2/9] Conditional Calls - Hash Table Mathieu Desnoyers
2007-05-29 18:33 ` [patch 3/9] Conditional Calls - Non Optimized Architectures Mathieu Desnoyers
2007-05-29 18:34 ` [patch 4/9] Conditional Calls - Add kconfig menus Mathieu Desnoyers
2007-05-29 18:34 ` [patch 5/9] Conditional Calls - i386 Optimization Mathieu Desnoyers
2007-05-29 18:34 ` [patch 6/9] Conditional Calls - PowerPC Optimization Mathieu Desnoyers
2007-05-29 18:34 ` [patch 7/9] Conditional Calls - Documentation Mathieu Desnoyers
2007-05-29 18:34 ` [patch 8/9] F00F bug fixup for i386 - use conditional calls Mathieu Desnoyers
2007-05-29 18:34 ` Mathieu Desnoyers [this message]
2007-05-30 12:15 ` [patch 0/9] Conditional Calls Mathieu Desnoyers
-- strict thread matches above, loose matches on Subject: below --
2007-05-30 14:00 [patch 0/9] Conditional Calls - for 2.6.22-rc2-mm1 Mathieu Desnoyers
2007-05-30 14:00 ` [patch 9/9] Scheduler profiling - Use conditional calls Mathieu Desnoyers
2007-05-30 20:34 ` Andrew Morton
2007-06-01 15:54 ` Mathieu Desnoyers
2007-06-01 16:19 ` Andrew Morton
2007-06-01 16:33 ` Mathieu Desnoyers
2007-05-30 20:59 ` William Lee Irwin III
2007-05-31 21:12 ` Mathieu Desnoyers
2007-05-31 23:41 ` William Lee Irwin III
2007-06-04 22:20 ` Mathieu Desnoyers
2007-05-30 21:44 ` Matt Mackall
2007-05-31 21:36 ` Mathieu Desnoyers
2007-05-31 13:39 ` Andi Kleen
2007-05-31 22:07 ` Mathieu Desnoyers
2007-05-31 22:33 ` Andi Kleen
2007-06-04 22:20 ` Mathieu Desnoyers
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=20070529183710.683711996@polymtl.ca \
--to=mathieu.desnoyers@polymtl.ca \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox