From: Steven Rostedt <rostedt@goodmis.org>
To: Prarit Bhargava <prarit@redhat.com>
Cc: linux-kernel@vger.kernel.org, dzickus@redhat.com
Subject: Re: [PATCH]: Use cmpxchg() in WARN_*_ONCE() functions
Date: Thu, 31 Mar 2011 11:23:19 -0400 [thread overview]
Message-ID: <20110331152319.GC14441@home.goodmis.org> (raw)
In-Reply-To: <20110331124607.13219.33332.sendpatchset@prarit.bos.redhat.com>
On Thu, Mar 31, 2011 at 08:46:07AM -0400, Prarit Bhargava wrote:
> An issue popped up where WARN_ON_ONCE() was used in a callback function
> in smp_call_function(). This resulted in the WARN_ON executing multiple times
> when it should have only executed once.
But that is just once per cpu, correct?
>
> I then did
>
> for (i = 0; i < 1000000; i++)
> on_each_cpu(prarit_callback, NULL, 0);
>
> The current code, of course, explodes :). That's the bug I'm trying to fix.
How exactly does it explode? How many CPUs do you have, and does this
still just print once per CPU?
> What is interesting in this test, however, is the impact that checking the
> !__warned flag has [Aside: Checking the !__warned flag is an enhancement
> and is not explicitly required for this code].
>
> A run with just (!cmpxchg(&__warned, 0, 1)) results in an average of 21.323s,
> and a run with (!__warned && !cmpxchg(&__warned, 0, 1)) results in an
> average of 20.233s. Of course, the !__warned is not necessary for the code
> to work properly but it seems to be a significant impact to the time to run
> this code.
Yes adding the check for !__warned first should have obvious benefits.
I really do not see anything wrong with this patch, but personally, I
would rather fix what caused the WARN_ON_ONCE() than fix the warning
itself, as long as the warning itself does not really break anything
else.
-- Steve
next prev parent reply other threads:[~2011-03-31 15:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-31 12:46 Prarit Bhargava
2011-03-31 15:23 ` Steven Rostedt [this message]
2011-03-31 15:32 ` Prarit Bhargava
2011-04-02 12:51 ` Prarit Bhargava
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=20110331152319.GC14441@home.goodmis.org \
--to=rostedt@goodmis.org \
--cc=dzickus@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=prarit@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
Powered by JetHome