LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH -v2] ring-buffer: add paranoid checks for loops
Date: Fri, 31 Oct 2008 10:00:09 -0400 (EDT) [thread overview]
Message-ID: <alpine.DEB.1.10.0810310958400.13290@gandalf.stny.rr.com> (raw)
In-Reply-To: <20081031093804.GF30317@elte.hu>
On Fri, 31 Oct 2008, Ingo Molnar wrote:
>
> > + /*
> > + * This should normally only loop twice. But because the
> > + * start of the reader inserts an empty page, it causes
> > + * a case where we will loop three times. There should be no
> > + * reason to loop four times (that I know of).
> > + */
> > + if (unlikely(paranoid > 2)) {
> > + RB_WARN_ON(cpu_buffer, 1);
> > + reader = NULL;
> > + goto out;
> > + }
> > + paranoid++;
>
> ok, the explanations look nice now.
>
> A small nit - the above comment suggests that looping 4 times is the
> anomaly - still the test is for paranoid > 2 ?
Yes, that's because the variable started at 0. So > 2 really means the
loop iterated more than 3.
My last patch changed it to be a bit easier to understand...
if (unlikely(++nr_loops > 3)) {
-- Steve
prev parent reply other threads:[~2008-10-31 14:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-29 22:48 [PATCH] " Steven Rostedt
2008-10-30 18:45 ` Ingo Molnar
2008-10-30 19:00 ` Steven Rostedt
2008-10-31 3:16 ` [PATCH -v2] " Steven Rostedt
2008-10-31 9:38 ` Ingo Molnar
2008-10-31 13:58 ` [PATCH -v3] " Steven Rostedt
2008-11-03 10:10 ` Ingo Molnar
2008-10-31 14:00 ` Steven Rostedt [this message]
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=alpine.DEB.1.10.0810310958400.13290@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--subject='Re: [PATCH -v2] ring-buffer: add paranoid checks for loops' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).