From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 1/2] ring-buffer: remove complex calculations in ring-buffer-test
Date: Thu, 07 May 2009 12:22:22 -0400 [thread overview]
Message-ID: <20090507162302.053953109@goodmis.org> (raw)
In-Reply-To: 20090507162221.413243886@goodmis.org
[-- Attachment #1: 0001-ring-buffer-remove-complex-calculations-in-ring-buf.patch --]
[-- Type: text/plain, Size: 2208 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
Ingo Molnar thought that the code to calculate the time in cond_resched
is a bit too ugly and is not needed. This patch removes it and replaces
it with a simple call to cond_resched. I kept the comment that explains
the reason for the cond_resched.
[ Impact: remove ugly code ]
Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/ring_buffer_benchmark.c | 37 ++++++---------------------------
1 files changed, 7 insertions(+), 30 deletions(-)
diff --git a/kernel/trace/ring_buffer_benchmark.c b/kernel/trace/ring_buffer_benchmark.c
index a26fc67..f4ceb45 100644
--- a/kernel/trace/ring_buffer_benchmark.c
+++ b/kernel/trace/ring_buffer_benchmark.c
@@ -185,35 +185,6 @@ static void ring_buffer_consumer(void)
complete(&read_done);
}
-/*
- * If we are a non preempt kernel, the 10 second run will
- * stop everything while it runs. Instead, we will call cond_resched
- * and also add any time that was lost by a rescedule.
- */
-#ifdef CONFIG_PREEMPT
-static void sched_if_needed(struct timeval *start_tv, struct timeval *end_tv)
-{
-}
-#else
-static void sched_if_needed(struct timeval *start_tv, struct timeval *end_tv)
-{
- struct timeval tv;
-
- cond_resched();
- do_gettimeofday(&tv);
- if (tv.tv_usec < end_tv->tv_usec) {
- tv.tv_usec += 1000000;
- tv.tv_sec--;
- }
- start_tv->tv_sec += tv.tv_sec - end_tv->tv_sec;
- start_tv->tv_usec += tv.tv_usec - end_tv->tv_usec;
- if (start_tv->tv_usec > 1000000) {
- start_tv->tv_usec -= 1000000;
- start_tv->tv_sec++;
- }
-}
-#endif
-
static void ring_buffer_producer(void)
{
struct timeval start_tv;
@@ -250,7 +221,13 @@ static void ring_buffer_producer(void)
if (consumer && !(++cnt % wakeup_interval))
wake_up_process(consumer);
- sched_if_needed(&start_tv, &end_tv);
+ /*
+ * If we are a non preempt kernel, the 10 second run will
+ * stop everything while it runs. Instead, we will call
+ * cond_resched and also add any time that was lost by a
+ * rescedule.
+ */
+ cond_resched();
} while (end_tv.tv_sec < (start_tv.tv_sec + RUN_TIME) && !kill_test);
pr_info("End ring buffer hammer\n");
--
1.6.2.4
--
next prev parent reply other threads:[~2009-05-07 16:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-07 16:22 [PATCH 0/2] [GIT PULL] tracing/ring-buffer: updates to tip Steven Rostedt
2009-05-07 16:22 ` Steven Rostedt [this message]
2009-05-07 16:22 ` [PATCH 2/2] tracing: append ":*" to internal setting of system events Steven Rostedt
2009-05-07 17:38 ` [PATCH 0/2] [GIT PULL] tracing/ring-buffer: updates to tip Ingo Molnar
2009-05-07 17:50 ` Ingo Molnar
2009-05-07 18:05 ` Steven Rostedt
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=20090507162302.053953109@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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