On 15.07.2022 19:03, Julien Grall wrote:
> @@ -1806,8 +1806,22 @@ static void _init_heap_pages(const struct page_info
> *pg,
>
> while ( s < e )
> {
> - free_heap_pages(mfn_to_page(_mfn(s)), 0, need_scrub);
> - s += 1UL;
> + /*
> + * For s == 0, we simply use the largest increment by checking the
> + * MSB of the region size. For s != 0, we also need to ensure that
> the
> + * chunk is properly sized to end at power-of-two alignment. We do
> this
> + * by checking the LSB of the start address and use its index as
> + * the increment. Both cases need to be guarded by MAX_ORDER.
s/guarded/bounded/ ?
> + * Note that the value of ffsl() and flsl() starts from 1 so we need
> + * to decrement it by 1.
> + */
> + int inc_order = min(MAX_ORDER, flsl(e - s) - 1);
unsigned int, since ...
> + if ( s )
> + inc_order = min(inc_order, ffsl(s) - 1);
> + free_heap_pages(mfn_to_page(_mfn(s)), inc_order, need_scrub);
... that's what the function parameter says, and the value also can go
negative? Preferably with these adjustments
Reviewed-by: Jan Beulich <[email protected]>
Jan