From: Steven Rostedt <rostedt@goodmis.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>,
fweisbec@gmail.com, mingo@redhat.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] tracing - putting cond_resched into tace_pipe loop
Date: Mon, 14 Mar 2011 10:07:31 -0400 [thread overview]
Message-ID: <1300111651.9910.87.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <20110313145811.GA30558@redhat.com>
On Sun, 2011-03-13 at 15:58 +0100, Oleg Nesterov wrote:
> On 03/12, Jiri Olsa wrote:
> >
> > --- 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;
>
> First of all: I do not pretend I understand this code ;) Still, a
> couple of nits.
>
> -EINTR doesn't look exactly right, I'd suggest -ERESTARTSYS. The same
> for tracing_wait_pipe() btw, I think it should be fixed.
Yeah, the tracing_wait_pipe() could be changed. I probably copied that
from someplace else in the kernel ;)
>
>
>
> I wonder if it makes sense to simply "break" if signal_pending(), it
> is possible we already have something to report via trace_seq_to_user().
> Then we could do
>
> - if (sret == -EBUSY)
> - goto waitagain;
> + if (sret == -EBUSY) {
> + if (!signal_pending())
> + goto waitagain;
> + sret = -ERESTARTSYS;
> + }
>
> Or we can change tracing_wait_pipe() to check signal_pending()
> uncondditionally, I dunno.
>
> Up to you, but note that otherwise the logic looks a bit strange.
> Suppose that signal_pending() is already true when we call
> tracing_wait_pipe(). In this case we are going to do the "unnecessary"
> work and then return EINTR/ERESTART. This is correct, the next
> invocation does trace_seq_to_user() before anything else, just
> looks a bit strange.
I'm not sure that this needs the signal_pending() or the break, or even
the cond_resched(). Perhaps the first patch fixes the bug. But that
while loop does not block, and it should just spin enough to fill a
page. If it is not filling the page then that's a bug.
Jiri,
Can you reproduce the bug with just he first patch? Actually, I can
reproduce it on vanilla, I'll apply your first patch and see if that
fixes things. If not, then we need to find out why and fix those.
-- Steve
next prev parent reply other threads:[~2011-03-14 14:07 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 ` [PATCH 2/2] tracing - putting cond_resched into tace_pipe loop Jiri Olsa
2011-03-13 14:58 ` Oleg Nesterov
2011-03-14 14:07 ` Steven Rostedt [this message]
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=1300111651.9910.87.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
/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®