• Suzuki K Poulose's avatar
    mm, compaction: make sure we isolate a valid PFN · e577c8b6
    Suzuki K Poulose authored
    When we have holes in a normal memory zone, we could endup having
    cached_migrate_pfns which may not necessarily be valid, under heavy memory
    pressure with swapping enabled ( via __reset_isolation_suitable(),
    triggered by kswapd).
    
    Later if we fail to find a page via fast_isolate_freepages(), we may end
    up using the migrate_pfn we started the search with, as valid page.  This
    could lead to accessing NULL pointer derefernces like below, due to an
    invalid mem_section pointer.
    
    Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008 [47/1825]
     Mem abort info:
       ESR = 0x96000004
       Exception class = DABT (current EL), IL = 32 bits
       SET = 0, FnV = 0
       EA = 0, S1PTW = 0
     Data abort info:
       ISV = 0, ISS = 0x00000004
       CM = 0, WnR = 0
     user pgtable: 4k pages, 48-bit VAs, pgdp = 0000000082f94ae9
     [0000000000000008] pgd=0000000000000000
     Internal error: Oops: 96000004 [#1] SMP
     ...
     CPU: 10 PID: 6080 Comm: qemu-system-aar Not tainted...
    e577c8b6
compaction.c 75 KB