Re: [PATCH v6 2/8] mm,memory_hotplug: Relax fully spanned sections check

From: Oscar Salvador
Date: Tue Apr 06 2021 - 12:34:13 EST


On 2021-04-06 17:32, David Hildenbrand wrote:
I'd only relax start_pfn. That way the function is pretty much
impossible to abuse for sub-section onlining/offlining.

if (WARN_ON_ONCE(!nr_pages ||
!IS_ALIGNED(start_pfn, pageblock_nr_pages))
!IS_ALIGNED(start_pfn + nr_pages, PAGES_PER_SECTION)))

But this is not going to work.
When using memmap_on_memory, the nr of pages that online_pages() and offline_pages() get might be less than PAGES_PER_SECTION, so this check will always blow us up.

--
Oscar Salvador
SUSE L3