• Wen Congyang's avatar
    memory-hotplug, mm/sparse.c: clear the memory to store struct page · 3ac19f8e
    Wen Congyang authored
    If sparse memory vmemmap is enabled, we can't free the memory to store
    struct page when a memory device is hotremoved, because we may store
    struct page in the memory to manage the memory which doesn't belong to
    this memory device.  When we hotadded this memory device again, we will
    reuse this memory to store struct page, and struct page may contain some
    obsolete information, and we will get bad-page state:
    
      init_memory_mapping: [mem 0x80000000-0x9fffffff]
      Built 2 zonelists in Node order, mobility grouping on.  Total pages: 547617
      Policy zone: Normal
      BUG: Bad page state in process bash  pfn:9b6dc
      page:ffffea0002200020 count:0 mapcount:0 mapping:          (null) index:0xfdfdfdfdfdfdfdfd
      page flags: 0x2fdfdfdfd5df9fd(locked|referenced|uptodate|dirty|lru|active|slab|owner_priv_1|private|private_2|writeback|head|tail|swapcache|reclaim|swapbacked|unevictable|uncached|compound_lock)
      Modules linked in: netconsole acpiphp pci_hotplug ...
    3ac19f8e
sparse.c 20.7 KB