+ (*online_page_callback)(pfn_to_page(pfn), pageblock_order);
+ pfn += 1 << pageblock_order;
pfn += pageblock_nr_pages;
Can you add a comment why we can be sure that we are off by a single pageblock? What about s390x where a MAX_ORDER_NR_PAGES == 4 * pageblock_nr_pages?
Would it make thing simpler to just do a
while (!IS_ALIGNED(pfn, MAX_ORDER_NR_PAGES)) {
(*online_page_callback)(pfn_to_page(pfn), 0);
pfn++;
}
Honestly, I did not spend much time thinking on other platforms other
than arm64/x86_64.
But I think that that would be the universal solution as we do not make
any assumptions.
I will replace it.
I think you can safely go with
while (!IS_ALIGNED(pfn, MAX_ORDER_NR_PAGES)) {
(*online_page_callback)(pfn_to_page(pfn), pageblock_order);
pfn += pageblock_nr_pages;
}
and maybe add before the loop
VM_BUG_ON(!IS_ALIGNED(pfn, pageblock_nr_pages));
as help for the reader that this always holds.
--
Thanks,
David / dhildenb