Re: [PATCH v1 18/29] mm: remove __folio_test_movable()
From: David Hildenbrand <hidden>
Date: 2025-07-01 12:36:24
Also in:
linux-doc, linux-fsdevel, linux-mm, lkml, virtualization
quoted
--- include/linux/page-flags.h | 6 ------ mm/migrate.c | 43 ++++++++++++-------------------------- mm/vmscan.c | 6 ++++-- 3 files changed, 17 insertions(+), 38 deletions(-)diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index c67163b73c5ec..4c27ebb689e3c 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h@@ -744,12 +744,6 @@ static __always_inline bool PageAnon(const struct page *page) return folio_test_anon(page_folio(page)); } -static __always_inline bool __folio_test_movable(const struct folio *folio) -{ - return ((unsigned long)folio->mapping & PAGE_MAPPING_FLAGS) == - PAGE_MAPPING_MOVABLE; -} -Woah, wait, does this mean we can remove PAGE_MAPPING_MOVABLE??
Jup :)
Nice!quoted
static __always_inline bool page_has_movable_ops(const struct page *page) { return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==diff --git a/mm/migrate.c b/mm/migrate.c index 587af35b7390d..15d3c1031530c 100644 --- a/mm/migrate.c +++ b/mm/migrate.c@@ -219,12 +219,7 @@ void putback_movable_pages(struct list_head *l) continue; } list_del(&folio->lru); - /* - * We isolated non-lru movable folio so here we can use - * __folio_test_movable because LRU folio's mapping cannot - * have PAGE_MAPPING_MOVABLE. - */So hate these references to 'LRU' as in meaning 'pages that could be on the LRU'.
Yeah, it's a historical thing. But for anything we isolated, it had to be an LRU folio (PageLRU) because that's how we were even able to isolate it ... from the LRU. [...]
quoted
diff --git a/mm/vmscan.c b/mm/vmscan.c index 098bcc821fc74..103dfc729a823 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c@@ -1658,9 +1658,11 @@ unsigned int reclaim_clean_pages_from_list(struct zone *zone, unsigned int noreclaim_flag; list_for_each_entry_safe(folio, next, folio_list, lru) { + /* TODO: these pages should not even appear in this list. */ + if (page_has_movable_ops(&folio->page))VM_WARN_ON_ONCE()?
Well, no, it can currently still happen. But really, movable_ops pages are not folios that could ever be reclaimed that way. So the TODO highlights that movable_ops pages should never even be put in a list (page->lru will go away). -- Cheers, David / dhildenb