• David Rientjes's avatar
    mm, thp: avoid excessive compaction latency during fault · 75f30861
    David Rientjes authored
    Synchronous memory compaction can be very expensive: it can iterate an
    enormous amount of memory without aborting, constantly rescheduling,
    waiting on page locks and lru_lock, etc, if a pageblock cannot be
    defragmented.
    
    Unfortunately, it's too expensive for transparent hugepage page faults and
    it's much better to simply fallback to pages.  On 128GB machines, we find
    that synchronous memory compaction can take O(seconds) for a single thp
    fault.
    
    Now that async compaction remembers where it left off without strictly
    relying on sync compaction, this makes thp allocations best-effort without
    causing egregious latency during fault.  We still need to retry async
    compaction after reclaim, but this won't stall for seconds.
    Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
    Acked-by: default avatarMel Gorman <mgorman@suse.de>
    Cc: Greg Thelen <gthelen@google.com>
    Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Hugh Dickins <hughd@google.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    75f30861
page_alloc.c 182 KB