On Fri, 4 Mar 2022, Hugh Dickins wrote: > __isolate_lru_page_prepare() conflates two unrelated functions, with > the flags to one disjoint from the flags to the other; and hides some > of the important checks outside of isolate_migratepages_block(), where > the sequence is better to be visible. It comes from the days of lumpy > reclaim, before compaction, when the combination made more sense. > > Move what's needed by mm/compaction.c isolate_migratepages_block() inline > there, and what's needed by mm/vmscan.c isolate_lru_pages() inline there. > > Shorten "isolate_mode" to "mode", so the sequence of conditions is easier > to read. Declare a "mapping" variable, to save one call to page_mapping() > (but not another: calling again after page is locked is necessary). > Simplify isolate_lru_pages() with a "move_to" list pointer. > > Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx> Acked-by: David Rientjes <rientjes@xxxxxxxxxx>