Commit d33695b1 authored by David Hildenbrand's avatar David Hildenbrand Committed by Linus Torvalds
Browse files

mm/memory_hotplug: poison memmap in remove_pfn_range_from_zone()

Let's poison the pages similar to when adding new memory in
sparse_add_section().  Also call remove_pfn_range_from_zone() from
memunmap_pages(), so we can poison the memmap from there as well.


Signed-off-by: default avatarDavid Hildenbrand <>
Cc: Michal Hocko <>
Cc: "Matthew Wilcox (Oracle)" <>
Cc: "Aneesh Kumar K.V" <>
Cc: Pavel Tatashin <>
Cc: Greg Kroah-Hartman <>
Cc: Dan Williams <>
Cc: Logan Gunthorpe <>
Cc: Oscar Salvador <>
Cc: Pankaj Gupta <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 1f8d75c1
......@@ -490,6 +490,9 @@ void __ref remove_pfn_range_from_zone(struct zone *zone,
struct pglist_data *pgdat = zone->zone_pgdat;
unsigned long flags;
/* Poison struct pages because they are now uninitialized again. */
page_init_poison(pfn_to_page(start_pfn), sizeof(struct page) * nr_pages);
* Zone shrinking code cannot properly deal with ZONE_DEVICE. So
......@@ -120,6 +120,8 @@ void memunmap_pages(struct dev_pagemap *pgmap)
nid = page_to_nid(first_page);
remove_pfn_range_from_zone(page_zone(first_page), PHYS_PFN(res->start),
if (pgmap->type == MEMORY_DEVICE_PRIVATE) {
PHYS_PFN(resource_size(res)), NULL);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment