From: David Daney <ddaney@caviumnetworks.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Daney <ddaney.cavm@gmail.com>,
David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
"ralf@linux-mips.org" <ralf@linux-mips.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
David Daney <david.daney@cavium.com>,
"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
Robin Holt <holt@sgi.com>
Subject: Re: [patch] hugetlb: remove dummy definitions of HPAGE_MASK and HPAGE_SIZE
Date: Mon, 21 Nov 2011 16:48:30 -0800 [thread overview]
Message-ID: <4ECAF15E.1070008@caviumnetworks.com> (raw)
In-Reply-To: <CA+55aFx==PGGLX9YXv1GOeTja4W0PSW8U4i8zkmtiZwqmFwHFw@mail.gmail.com>
On 11/21/2011 04:37 PM, Linus Torvalds wrote:
> On Mon, Nov 21, 2011 at 3:47 PM, David Daney<ddaney.cavm@gmail.com> wrote:
>>
>> These symbols are on dead code paths, so they are eliminated by the
>> compiler's Dead Code Elimination (DCE) optimizations, and the BUG() code
>> never gets emitted to the final executable.
>
> If you are so damn sure of that, then DON'T MAKE IT A BUG_ON! If you
> are 100% syre, then you might as well leave out the BUG_ON() entirely.
>
> Seriously. What's so hard to understand?
Really Linus, did you read the other half of the message you quoted?
The part you quote above explains the reason things are the way they
currently are.
The second part, that I think you may have missed, is the part I had
hoped you would read...
>
> Either you are 100% sure, or you are not. If you are 100% sure, then
> the BUG_ON() is pointless. And if you are not, then the BUG_ON() is
> *wrong*.
>
> Notice? The BUG_ON() is never *ever* valid. You cannot have it both
> ways. So stop pushing crap, already!
>
> So what are non-crap solutions?
>
> - the current one: error out at compile time (early) if somebody uses
> them in invalid contexts.
>
> This seems to be a good case, especially since apparently no actual
> current code wants to use them outside of the existing #ifdef's. And
> there is no reason to think that some random MIPS-only future code is
> a good enough reason to re-introduce these things
>
> - if you really want to use them, but expect the compiler to always
> compile them away as dead code, use a non-existing function linkage,
> so that you at least get a static failure at link-time for incorrect
> code, rather than some random BUG_ON() at run-time that may be
> impossible to find.
>
> See? There are real solutions. BUG_ON() is not one of them.
... because it said exactly what you say above.
I will send you a patch within the next two hours that shows what may be
an acceptable solution.
Thanks,
David Daney
next prev parent reply other threads:[~2011-11-22 0:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1321567050-13197-1-git-send-email-ddaney.cavm@gmail.com>
[not found] ` <alpine.DEB.2.00.1111171520130.20133@chino.kir.corp.google.com>
2011-11-17 23:22 ` [patch] hugetlb: remove dummy definitions of HPAGE_MASK and HPAGE_SIZE David Rientjes
2011-11-17 23:35 ` Andrew Morton
2011-11-17 23:44 ` David Rientjes
2011-11-17 23:52 ` David Daney
2011-11-17 23:57 ` Andrew Morton
2011-11-17 23:57 ` Andrew Morton
2011-11-17 23:57 ` David Rientjes
2011-11-17 23:57 ` David Rientjes
2011-11-21 22:23 ` David Daney
2011-11-21 22:43 ` Linus Torvalds
2011-11-21 23:23 ` David Daney
2011-11-21 23:43 ` Linus Torvalds
2011-11-21 23:50 ` Andrew Morton
2011-11-22 20:41 ` Andi Kleen
2011-11-21 23:47 ` David Daney
2011-11-21 23:53 ` Andrew Morton
2011-11-22 0:37 ` Linus Torvalds
2011-11-22 0:48 ` David Daney [this message]
2011-11-22 0:55 ` Linus Torvalds
2011-11-21 22:48 ` David Rientjes
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=4ECAF15E.1070008@caviumnetworks.com \
--to=ddaney@caviumnetworks.com \
--cc=akpm@linux-foundation.org \
--cc=david.daney@cavium.com \
--cc=ddaney.cavm@gmail.com \
--cc=holt@sgi.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=rientjes@google.com \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).