Skip to content
  • Joonsoo Kim's avatar
    mm/compaction: correct to flush migrated pages if pageblock skip happens · 1a16718c
    Joonsoo Kim authored
    
    
    We cache isolate_start_pfn before entering isolate_migratepages().  If
    pageblock is skipped in isolate_migratepages() due to whatever reason,
    cc->migrate_pfn can be far from isolate_start_pfn hence we flush pages
    that were freed.  For example, the following scenario can be possible:
    
    - assume order-9 compaction, pageblock order is 9
    - start_isolate_pfn is 0x200
    - isolate_migratepages()
      - skip a number of pageblocks
      - start to isolate from pfn 0x600
      - cc->migrate_pfn = 0x620
      - return
    - last_migrated_pfn is set to 0x200
    - check flushing condition
      - current_block_start is set to 0x600
      - last_migrated_pfn < current_block_start then do useless flush
    
    This wrong flush would not help the performance and success rate so this
    patch tries to fix it.  One simple way to know the exact position where
    we start to isolate migratable pages is that we cache it in
    isolate_migratepages() before entering actual isolation.  This patch
    implements that and fixes the problem.
    
    Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
    Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Minchan Kim <minchan@kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    1a16718c