lkml.org 
[lkml]   [2021]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 1/7] mm,memory_hotplug: Allocate memmap from the added memory range
From
Date
>>> +		(*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 could also go with

while (!IS_ALIGNED(pfn, MAX_ORDER_NR_PAGES)) {
(*online_page_callback)(pfn_to_page(pfn), pageblock_order);
pageblock_nr_pages;
}

And maybe add a comment why we can be sure it has to be aligned to
pageblocks. Or maybe rather add

VM_BUG_ON(IS_ALIGNED(pfn, pageblock_nr_pages));

--
Thanks,

David / dhildenb

\
 
 \ /
  Last update: 2021-03-01 09:32    [W:0.106 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site