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

Christoph Lameter
2007-07-23T19:43:03Z

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.

See also