From: David Daney <ddaney.cavm@gmail.com>
To: David Rientjes <rientjes@google.com>
Cc: "ralf@linux-mips.org" <ralf@linux-mips.org>,
"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
David Daney <david.daney@cavium.com>
Subject: Re: [PATCH] hugetlb: Provide a default HPAGE_SHIFT if !CONFIG_HUGETLB_PAGE
Date: Thu, 17 Nov 2011 09:21:14 -0800 [thread overview]
Message-ID: <4EC5428A.6030700@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1111162047170.13603@chino.kir.corp.google.com>
On 11/16/2011 08:56 PM, David Rientjes wrote:
> On Wed, 16 Nov 2011, David Daney wrote:
>
>>>> It is a well established kernel idiom to supply dummy values for symbols
>>>> that
>>>> are required to be defined in order to form a syntactically correct C
>>>> program,
>>>> but that are known by the programmer to be used only on dead code paths.
>>>>
>>>> This is exactly what we are doing here.
>>>>
>>>> To do otherwise requires that code be cluttered with #ifdefery.
>>>>
>>>
>>> You're wrong,
>>
>> Ok, then please tell me why:
>>
>> 1) the dummy version of is_vm_hugetlb_page() exists in hugetlb_inline.h?
>> 2) the dummy version of PageHuge() exists in hugetlb.h
[...]
>
> To avoid the #ifdef's,
Good, now we are on the same page.
The answer is not, as first suggested, to sprinkle #ifdefs all over the
place, but ...
> but you'll notice that they return either NULL, 0,
> or are a no-op. We don't substitute real values in dummy functions where
> they could be used in generic code as though they were valid. That's the
> problem with defining HPAGE_SHIFT to be PAGE_SHIFT and, yes, defining
> HPAGE_MASK and HPAGE_SIZE as well shouldn't be done and should be removed.
>
> We expect HPAGE_* to represent hugepages, not the native page size of the
> bare metal. This is why we do things like
>
> #define HPAGE_PMD_SHIFT ({ BUG(); 0; })
> #define HPAGE_PMD_MASK ({ BUG(); 0; })
> #define HPAGE_PMD_SIZE ({ BUG(); 0; })
... rather to fix HPAGE_SHIFT, HPAGE_MASK, and HPAGE_SIZE to be more
like these.
I will generate a version of the patch that does this, noting that it
the addition of a dummy definition of HPAGE_SHIFT is added to facilitate
cleaner architecture specific code for MIPS patches in linux-next.
Thanks,
David Daney
>
> for CONFIG_TRANSPARENT_HUGEPAGE=n. We don't want to pretend that they're
> valid outside the context of hugepages.
>
> We also never use HPAGE_SHIFT, HPAGE_MASK, or HPAGE_SIZE in generic code
> that isn't dependent on CONFIG_HUGETLB_PAGE. If you'd like to submit a
> patch to fix this in the mips tree, then that would be good, and if you'd
> like to submit a patch to remove these dummy definitions all together by
> auditing other arch code, then that would be great.
>
prev parent reply other threads:[~2011-11-17 17:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 19:43 [PATCH] hugetlb: Provide a default HPAGE_SHIFT if !CONFIG_HUGETLB_PAGE David Daney
2011-11-16 21:32 ` David Rientjes
2011-11-16 22:09 ` David Daney
2011-11-16 23:18 ` David Rientjes
2011-11-16 23:44 ` David Daney
2011-11-17 0:08 ` David Rientjes
2011-11-17 1:00 ` David Daney
2011-11-17 4:56 ` David Rientjes
2011-11-17 17:21 ` David Daney [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=4EC5428A.6030700@gmail.com \
--to=ddaney.cavm@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david.daney@cavium.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=rientjes@google.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;
as well as URLs for NNTP newsgroup(s).