Re: [PATCH 0/6] mm: make movable onlining suck less

From: Reza Arbab
Date: Wed Apr 05 2017 - 13:35:46 EST


On Wed, Apr 05, 2017 at 05:42:59PM +0200, Michal Hocko wrote:
But one thing that is really bugging me is how could you see low pfns in the previous oops. Please drop the last patch and sprinkle printks down the remove_memory path to see where this all go south. I believe that there is something in the initialization code lurking in my code. Please also scratch the pfn_valid check in online_pages diff. It will not help here.

Got it.
shrink_pgdat_span: start_pfn=0x10000, end_pfn=0x10100, pgdat_start_pfn=0x0, pgdat_end_pfn=0x20000

The problem is that pgdat_start_pfn here should be 0x10000. As you suspected, it never got set. This fixes things for me.

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 623507f..37c1b63 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -884,7 +884,7 @@ static void __meminit resize_pgdat_range(struct pglist_data *pgdat, unsigned lon
{
unsigned long old_end_pfn = pgdat_end_pfn(pgdat);

- if (start_pfn < pgdat->node_start_pfn)
+ if (!pgdat->node_spanned_pages || start_pfn < pgdat->node_start_pfn)
pgdat->node_start_pfn = start_pfn;

pgdat->node_spanned_pages = max(start_pfn + nr_pages, old_end_pfn) - pgdat->node_start_pfn;
---

Along these lines, maybe we should also do

- if (start_pfn < zone->zone_start_pfn)
+ if (zone_is_empty(zone) || start_pfn < zone->zone_start_pfn)

in resize_zone_range()?

--
Reza Arbab