Re: [LKP] efad4e475c [ 40.308255] Oops: 0000 [#1] PREEMPT SMP PTI
From: Matthew Wilcox
Date: Mon Feb 18 2019 - 12:57:31 EST
On Mon, Feb 18, 2019 at 06:05:58PM +0100, Michal Hocko wrote:
> + end_pfn = min(start_pfn + nr_pages,
> + zone_end_pfn(page_zone(pfn_to_page(start_pfn))));
>
> /* Check the starting page of each pageblock within the range */
> - for (; page < end_page; page = next_active_pageblock(page)) {
> - if (!is_pageblock_removable_nolock(page))
> + for (; start_pfn < end_pfn; start_pfn = next_active_pageblock(start_pfn)) {
> + if (!is_pageblock_removable_nolock(start_pfn))
If you have a zone which contains pfns that run from ULONG_MAX-n to ULONG_MAX,
end_pfn is going to wrap around to 0 and this loop won't execute. I think
you should use:
max_pfn = min(start_pfn + nr_pages,
zone_end_pfn(page_zone(pfn_to_page(start_pfn)))) - 1;
for (; start_pfn <= max_pfn; ...)