@@ -734,6 +734,7 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,
734
734
struct mem_section * ms = __pfn_to_section (pfn );
735
735
bool section_is_early = early_section (ms );
736
736
struct page * memmap = NULL ;
737
+ bool empty = false;
737
738
unsigned long * subsection_map = ms -> usage
738
739
? & ms -> usage -> subsection_map [0 ] : NULL ;
739
740
@@ -764,7 +765,8 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,
764
765
* For 2/ and 3/ the SPARSEMEM_VMEMMAP={y,n} cases are unified
765
766
*/
766
767
bitmap_xor (subsection_map , map , subsection_map , SUBSECTIONS_PER_SECTION );
767
- if (bitmap_empty (subsection_map , SUBSECTIONS_PER_SECTION )) {
768
+ empty = bitmap_empty (subsection_map , SUBSECTIONS_PER_SECTION );
769
+ if (empty ) {
768
770
unsigned long section_nr = pfn_to_section_nr (pfn );
769
771
770
772
/*
@@ -779,13 +781,15 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,
779
781
ms -> usage = NULL ;
780
782
}
781
783
memmap = sparse_decode_mem_map (ms -> section_mem_map , section_nr );
782
- ms -> section_mem_map = (unsigned long )NULL ;
783
784
}
784
785
785
786
if (section_is_early && memmap )
786
787
free_map_bootmem (memmap );
787
788
else
788
789
depopulate_section_memmap (pfn , nr_pages , altmap );
790
+
791
+ if (empty )
792
+ ms -> section_mem_map = (unsigned long )NULL ;
789
793
}
790
794
791
795
static struct page * __meminit section_activate (int nid , unsigned long pfn ,
0 commit comments