Skip to content

Commit 1f50344

Browse files
liupingfantorvalds
authored andcommitted
mm/sparse.c: reset section's mem_map when fully deactivated
After commit ba72b4c ("mm/sparsemem: support sub-section hotplug"), when a mem section is fully deactivated, section_mem_map still records the section's start pfn, which is not used any more and will be reassigned during re-addition. In analogy with alloc/free pattern, it is better to clear all fields of section_mem_map. Beside this, it breaks the user space tool "makedumpfile" [1], which makes assumption that a hot-removed section has mem_map as NULL, instead of checking directly against SECTION_MARKED_PRESENT bit. (makedumpfile will be better to change the assumption, and need a patch) The bug can be reproduced on IBM POWERVM by "drmgr -c mem -r -q 5" , trigger a crash, and save vmcore by makedumpfile [1]: makedumpfile, commit e73016540293 ("[v1.6.7] Update version") Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Pingfan Liu <[email protected]> Acked-by: Michal Hocko <[email protected]> Acked-by: David Hildenbrand <[email protected]> Cc: Dan Williams <[email protected]> Cc: Oscar Salvador <[email protected]> Cc: Baoquan He <[email protected]> Cc: Qian Cai <[email protected]> Cc: Kazuhito Hagio <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent c7a91bc commit 1f50344

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/sparse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,
789789
ms->usage = NULL;
790790
}
791791
memmap = sparse_decode_mem_map(ms->section_mem_map, section_nr);
792-
ms->section_mem_map = sparse_encode_mem_map(NULL, section_nr);
792+
ms->section_mem_map = (unsigned long)NULL;
793793
}
794794

795795
if (section_is_early && memmap)

0 commit comments

Comments
 (0)