@@ -744,6 +744,7 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,
744
744
struct mem_section * ms = __pfn_to_section (pfn );
745
745
bool section_is_early = early_section (ms );
746
746
struct page * memmap = NULL ;
747
+ bool empty ;
747
748
unsigned long * subsection_map = ms -> usage
748
749
? & ms -> usage -> subsection_map [0 ] : NULL ;
749
750
@@ -774,7 +775,8 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,
774
775
* For 2/ and 3/ the SPARSEMEM_VMEMMAP={y,n} cases are unified
775
776
*/
776
777
bitmap_xor (subsection_map , map , subsection_map , SUBSECTIONS_PER_SECTION );
777
- if (bitmap_empty (subsection_map , SUBSECTIONS_PER_SECTION )) {
778
+ empty = bitmap_empty (subsection_map , SUBSECTIONS_PER_SECTION );
779
+ if (empty ) {
778
780
unsigned long section_nr = pfn_to_section_nr (pfn );
779
781
780
782
/*
@@ -789,13 +791,15 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,
789
791
ms -> usage = NULL ;
790
792
}
791
793
memmap = sparse_decode_mem_map (ms -> section_mem_map , section_nr );
792
- ms -> section_mem_map = (unsigned long )NULL ;
793
794
}
794
795
795
796
if (section_is_early && memmap )
796
797
free_map_bootmem (memmap );
797
798
else
798
799
depopulate_section_memmap (pfn , nr_pages , altmap );
800
+
801
+ if (empty )
802
+ ms -> section_mem_map = (unsigned long )NULL ;
799
803
}
800
804
801
805
static struct page * __meminit section_activate (int nid , unsigned long pfn ,
0 commit comments