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