From: William Lee Irwin III <wli@holomorphy.com>
To: Arjan van de Ven <arjanv@redhat.com>,
Andrew Morton <akpm@osdl.org>, Con Kolivas <kernel@kolivas.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Instrumenting high latency
Date: Mon, 12 Jul 2004 01:47:48 -0700 [thread overview]
Message-ID: <20040712084748.GY21066@holomorphy.com> (raw)
In-Reply-To: <20040712084231.GX21066@holomorphy.com>
On Mon, Jul 12, 2004 at 10:29:40AM +0200, Arjan van de Ven wrote:
>> ... or reset the time(r) in need_resched() under the assumption that all
>> need_resched() callers will yield when it returns true...
On Mon, Jul 12, 2004 at 01:42:31AM -0700, William Lee Irwin III wrote:
> Might be a good enough approximation. Two examples and a counterexample...
Index: timing-2.6.7/include/linux/sched.h
===================================================================
--- timing-2.6.7.orig/include/linux/sched.h 2004-06-15 22:18:57.000000000 -0700
+++ timing-2.6.7/include/linux/sched.h 2004-07-12 01:45:08.000000000 -0700
@@ -1000,7 +1000,8 @@
return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
}
-static inline int need_resched(void)
+#define need_resched() ({ touch_preempt_timing(); __need_resched(); })
+static inline int __need_resched(void)
{
return unlikely(test_thread_flag(TIF_NEED_RESCHED));
}
Index: timing-2.6.7/include/linux/preempt.h
===================================================================
--- timing-2.6.7.orig/include/linux/preempt.h 2004-07-11 04:33:55.000000000 -0700
+++ timing-2.6.7/include/linux/preempt.h 2004-07-12 01:18:17.000000000 -0700
@@ -12,7 +12,9 @@
#ifdef CONFIG_PREEMPT_TIMING
void __inc_preempt_count(void);
void __dec_preempt_count(void);
+void touch_preempt_timing(void);
#else
+#define touch_preempt_timing() do { } while (0)
#ifdef CONFIG_PREEMPT
#define __inc_preempt_count() do { preempt_count()++; } while (0)
#define __dec_preempt_count() do { preempt_count()--; } while (0)
Index: timing-2.6.7/arch/i386/kernel/traps.c
===================================================================
--- timing-2.6.7.orig/arch/i386/kernel/traps.c 2004-07-12 00:10:27.000000000 -0700
+++ timing-2.6.7/arch/i386/kernel/traps.c 2004-07-12 01:34:58.000000000 -0700
@@ -969,14 +969,24 @@
}
__setup("preempt_thresh=", setup_preempt_thresh);
+static void __touch_preempt_timing(void *addr)
+{
+ rdtscll(__get_cpu_var(preempt_timings));
+ __get_cpu_var(preempt_entry) = (unsigned long)addr;
+}
+
+void touch_preempt_timing(void)
+{
+ if (preempt_count() == 1 && system_state == SYSTEM_RUNNING)
+ __touch_preempt_timing(__builtin_return_address(0));
+}
+EXPORT_SYMBOL(touch_preempt_timing);
+
void __inc_preempt_count(void)
{
preempt_count()++;
- if (preempt_count() == 1 && system_state == SYSTEM_RUNNING) {
- rdtscll(__get_cpu_var(preempt_timings));
- __get_cpu_var(preempt_entry)
- = (unsigned long)__builtin_return_address(0);
- }
+ if (preempt_count() == 1 && system_state == SYSTEM_RUNNING)
+ __touch_preempt_timing(__builtin_return_address(0));
}
EXPORT_SYMBOL(__inc_preempt_count);
next prev parent reply other threads:[~2004-07-12 8:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-12 6:29 Con Kolivas
2004-07-12 6:37 ` Andrew Morton
2004-07-12 6:43 ` Con Kolivas
2004-07-12 6:58 ` Andrew Morton
2004-07-12 7:00 ` [PATCH] " William Lee Irwin III
2004-07-12 7:34 ` Andrew Morton
2004-07-12 8:02 ` William Lee Irwin III
2004-07-12 8:38 ` William Lee Irwin III
2004-07-12 11:31 ` William Lee Irwin III
2004-07-12 14:32 ` William Lee Irwin III
2004-07-12 17:09 ` Martin Josefsson
2004-07-12 8:29 ` Arjan van de Ven
2004-07-12 8:42 ` William Lee Irwin III
2004-07-12 8:47 ` William Lee Irwin III [this message]
2004-07-12 10:41 ` Rajput
2004-07-12 10:44 ` William Lee Irwin III
2004-07-12 14:24 ` Martin J. Bligh
2004-07-12 14:27 ` Con Kolivas
2004-07-12 14:33 ` Martin J. Bligh
2004-07-12 14:42 ` Con Kolivas
2004-07-12 14:47 ` Martin J. Bligh
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=20040712084748.GY21066@holomorphy.com \
--to=wli@holomorphy.com \
--cc=akpm@osdl.org \
--cc=arjanv@redhat.com \
--cc=kernel@kolivas.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
all inboxes | Powered by JetHome®