On Wed, Dec 19, 2018 at 02:25:28PM +0000, Wei Yang wrote:
> >-                    iter = round_up(iter + 1, 1<<compound_order(page)) - 1;
> >+                    skip_pages = (1 << compound_order(head)) - (page - 
> >head);
> >+                    iter = round_up(iter + 1, skip_pages) - 1;
> 
> The comment of round_up says round up to next specified power of 2.  And
> second parameter must be a power of 2.
> 
> Look skip_pages not satisfy this.

I thought that gigantic pages were always allocated on 1GB aligned.
At least alloc_gigantic_page() looks for 1GB range, aligned to that.
But I see that in alloc_contig_range(), the boundaries can differ.

Anyway, unless I am missing something, I think that we could just
get rid of the round_up() and do something like:

<--
skip_pages = (1 << compound_order(head)) - (page - head);
iter = skip_pages - 1;
-->

which looks more simple IMHO.

It should just work for 2MB and 1GB Hugepages.
-- 
Oscar Salvador
SUSE L3

Reply via email to