From: Jiri Olsa <jolsa@redhat.com>
To: rostedt@goodmis.org, fweisbec@gmail.com, mingo@redhat.com
Cc: linux-kernel@vger.kernel.org, oleg@redhat.com,
Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH 2/2] tracing - putting cond_resched into tace_pipe loop
Date: Sat, 12 Mar 2011 23:59:46 +0100 [thread overview]
Message-ID: <1299970786-8075-3-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1299970786-8075-1-git-send-email-jolsa@redhat.com>
Adding cond_resched call to the tracing_read_pipe while loop.
Plus check for signal to leave the loop.
This will protect us from soft lockup on NON preemptive kernels
and improve latency.
Thanks a lot to Oleg Nestorov for helping me to nail this down.
wbr,
jirka
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
kernel/trace/trace.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 20d84f8..7d66476 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3237,10 +3237,23 @@ waitagain:
* One of the trace_seq_* functions is not used properly.
*/
WARN_ON(iter->seq.full);
+
+ /*
+ * There's a chance this loop might get quite tight,
+ * causing latency in non preemptive kernel.
+ */
+ cond_resched();
+ if (signal_pending(current)) {
+ sret = -EINTR;
+ break;
+ }
}
trace_access_unlock(iter->cpu_file);
trace_event_read_unlock();
+ if (sret == -EINTR)
+ goto out;
+
/* Now copy what we have to the user */
sret = trace_seq_to_user(&iter->seq, ubuf, cnt);
if (iter->seq.readpos >= iter->seq.len)
--
1.7.1
next prev parent reply other threads:[~2011-03-12 23:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-12 22:59 [PATCH 0/2] tracing - avoid soft lockup in trace_pipe Jiri Olsa
2011-03-12 22:59 ` [PATCH 1/2] tracing - trace lost events properly Jiri Olsa
2011-03-12 22:59 ` Jiri Olsa [this message]
2011-03-13 14:58 ` [PATCH 2/2] tracing - putting cond_resched into tace_pipe loop Oleg Nesterov
2011-03-14 14:07 ` Steven Rostedt
2011-03-14 14:18 ` Jiri Olsa
2011-03-14 14:28 ` Steven Rostedt
2011-03-14 15:07 ` Jiri Olsa
2011-03-14 15:20 ` Steven Rostedt
2011-03-14 18:06 ` [PATCHv2] tracing - avoid soft lockup in trace_pipe Jiri Olsa
2011-03-21 12:10 ` Jiri Olsa
2011-03-25 2:23 ` Steven Rostedt
2011-03-25 3:14 ` Steven Rostedt
2011-03-25 11:05 ` [PATCHv3] " Jiri Olsa
2011-03-25 15:46 ` Steven Rostedt
2011-03-25 15:49 ` Steven Rostedt
2011-03-25 15:53 ` Jiri Olsa
2011-04-27 15:22 ` [tip:perf/core] tracing: Avoid " tip-bot for Jiri Olsa
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=1299970786-8075-3-git-send-email-jolsa@redhat.com \
--to=jolsa@redhat.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=rostedt@goodmis.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
Powered by JetHome