These changes are a raw update to a vanilla kernel 4.1.10, with the
[kvmfornfv.git] / kernel / drivers / base / node.c
index a2aa65b..b10479c 100644 (file)
@@ -388,6 +388,16 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
        for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
                int page_nid;
 
+               /*
+                * memory block could have several absent sections from start.
+                * skip pfn range from absent section
+                */
+               if (!pfn_present(pfn)) {
+                       pfn = round_down(pfn + PAGES_PER_SECTION,
+                                        PAGES_PER_SECTION) - 1;
+                       continue;
+               }
+
                page_nid = get_nid_for_pfn(pfn);
                if (page_nid < 0)
                        continue;