[RAMEN9610-12171] mm/hpa: fix possible inifinite page isolation
authorCho KyongHo <pullip.cho@samsung.com>
Thu, 7 Feb 2019 07:52:12 +0000 (16:52 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:17 +0000 (20:23 +0300)
commit3f5cde74b0a58fd3d1ec27b276ac73507faf8d3d
treef097c0f787a9fc48e8617f62f281622d6dc5fa71
parentde5079aa756ecd261e959f7c6a2c3bd271dde518
[RAMEN9610-12171] mm/hpa: fix possible inifinite page isolation

If HPA starts isolating pages in a page block that is currently
isolated in another thread, the page block possibly remains isolated
infinitely because HPA decides the target migratetype of the page block
from the current migratetype of it. Once it gets migratetype of a page
block as MT_ISOLATE and passes it to alloc_contig_range(), the final
migratetype of the page block becomes MT_ISOLATE which is not expected.

See the following race condition described by Jaewon Kim.
CPU0                              CPU1

get_pageblock_migratetype
 -> get MT_NON_ISOLATE as previous MT
alloc_contig_range_fast
 __alloc_contig_range
  start_isolate_page_range
   -> set to MT_ISOALTE
                                  get_pageblock_migratetype
                                   -> get MT_ISOLATE as previous MT
                                   alloc_contig_range_fast
                                    __alloc_contig_range
                                     start_isolate_page_range
                                      -> set to MT_ISOALTE
  undo_isolate_page_range to the
   -> recover to MT_NON_ISOLATE
                                     undo_isolate_page_range
                                      -> recover to MT_ISOLATE

He observed a page block is remained isolated for a log time.

Change-Id: I933b5c1a281ee32f400d63913c52301bb01cb550
Reported-by: Jaewon Kim <jaewon31.kim@samsung.com>
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
mm/hpa.c