Re: [PATCH 1/5] [hugetlb] Introduce BASE_PAGES_PER_HPAGE constant

Adam Litke
2007-07-23T19:52:56Z

On Mon, 2007-07-23 at 12:43 -0700, Christoph Lameter wrote:
> On Fri, 13 Jul 2007 08:16:31 -0700
> Adam Litke <agl@us.ibm.com> wrote:
>
>
> > In many places throughout the kernel, the expression
> > (HPAGE_SIZE/PAGE_SIZE) is used to convert quantities in huge page
> > units to a number of base pages. Reduce redundancy and make the code
> > more readable by introducing a constant BASE_PAGES_PER_HPAGE whose
> > name more clearly conveys the intended conversion.
>
> It may be better to put in a generic way of determining the pages of a
> compound page.
>
> Usually
>
> 1 << compound_order(page) will do the trick.

Yes, that is much nicer, thanks!

--
Adam Litke - (agl at us.ibm.com)
IBM Linux Technology Center