| To: | David Daney <ddaney.cavm@gmail.com> |
|---|---|
| Subject: | Re: [patch] hugetlb: remove dummy definitions of HPAGE_MASK and HPAGE_SIZE |
| From: | David Rientjes <rientjes@google.com> |
| Date: | Thu, 17 Nov 2011 15:57:50 -0800 (PST) |
| Cc: | 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> |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=date:from:x-x-sender:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version:content-type; bh=FCcT1/i26AwKaG78VwkIp/cF+DLrukJMrjpbKW+zYyk=; b=O8exKDIfXSHTXghvORxv7SslgoH5dg5SujYaD4bOX88UKadMYxc8X7uzIVeW+62D5s Radn6Bpi4hoKsrzOhULQ== |
| In-reply-to: | <4EC59E3C.5070204@gmail.com> |
| References: | <1321567050-13197-1-git-send-email-ddaney.cavm@gmail.com> <alpine.DEB.2.00.1111171520130.20133@chino.kir.corp.google.com> <alpine.DEB.2.00.1111171522131.20133@chino.kir.corp.google.com> <20111117153526.f90ee248.akpm@linux-foundation.org> <alpine.DEB.2.00.1111171538540.13555@chino.kir.corp.google.com> <4EC59E3C.5070204@gmail.com> |
| Sender: | linux-mips-bounce@linux-mips.org |
| User-agent: | Alpine 2.00 (DEB 1167 2008-08-23) |
On Thu, 17 Nov 2011, David Daney wrote:
> A counter argument would be:
>
> There are hundreds of places in the kernel where dummy definitions are
> selected by !CONFIG_* so that we can do:
>
> if (test_something()) {
> do_one_thing();
> } else {
> do_the_other_thing();
> }
>
>
> Rather than:
>
> #ifdef CONFIG_SOMETHING
> if (test_something()) {
> do_one_thing();
> } else
> #else
> {
> do_the_other_thing();
> }
>
>
>
> We even do this all over the place with dummy definitions selected by
> CONFIG_HUGETLB_PAGE, What exactly makes HPAGE_MASK special and not the
> hundreds of other similar situations?
>
Dummy functions that return 0 when a feature isn't enabled isn't the
problem, that's very convenient. Definitions of constants are a
completely separate story because they can be easily used outside the
required context and cause brekage. What happens if you reference a
variable in a function that is declarated in a different function? Does
the compiler put a BUG() in there and let you explode at runtime? This is
just absurd, every other arch has done the necessary declarations in their
own header files and everything works fine because there's a clear config
dependency on using HPAGE_*. Adding dummy definitions to panic at runtime
is irresponsibly to an extreme.
|
| Previous by Date: | Re: [patch] hugetlb: remove dummy definitions of HPAGE_MASK and HPAGE_SIZE, Andrew Morton |
|---|---|
| Next by Date: | [PATCH v2] Add MIPS-assembler version of twofish crypto algorithm, David Kuehling |
| Previous by Thread: | Re: [patch] hugetlb: remove dummy definitions of HPAGE_MASK and HPAGE_SIZE, Andrew Morton |
| Next by Thread: | Re: [patch] hugetlb: remove dummy definitions of HPAGE_MASK and HPAGE_SIZE, David Daney |
| Indexes: | [Date] [Thread] [Top] [All Lists] |