Re: [PATCH v14 061/138] mm/migrate: Add folio_migrate_flags()
From: Vlastimil Babka <hidden>
Date: 2021-08-11 15:16:31
Also in:
linux-fsdevel, lkml
On 7/15/21 5:35 AM, Matthew Wilcox (Oracle) wrote:
Turn migrate_page_states() into a wrapper around folio_migrate_flags(). Also convert two functions only called from folio_migrate_flags() to be folio-based. ksm_migrate_page() becomes folio_migrate_ksm() and copy_page_owner() becomes folio_copy_owner(). folio_migrate_flags() alone shrinks by two thirds -- 1967 bytes down to 642 bytes. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
After fixing the bug below, Acked-by: Vlastimil Babka <redacted>
quoted hunk ↗ jump to hunk
--- a/include/linux/migrate.h +++ b/include/linux/migrate.h
...
quoted hunk ↗ jump to hunk
@@ -36,10 +36,10 @@ static inline void split_page_owner(struct page *page, unsigned int nr) if (static_branch_unlikely(&page_owner_inited)) __split_page_owner(page, nr); } -static inline void copy_page_owner(struct page *oldpage, struct page *newpage) +static inline void folio_copy_owner(struct folio *newfolio, struct folio *old)
This changed order so that new is first. ...
quoted hunk ↗ jump to hunk
--- a/mm/migrate.c +++ b/mm/migrate.c@@ -538,82 +538,80 @@ int migrate_huge_page_move_mapping(struct address_space *mapping, } /* - * Copy the page to its new location + * Copy the flags and some other ancillary information */ -void migrate_page_states(struct page *newpage, struct page *page) +void folio_migrate_flags(struct folio *newfolio, struct folio *folio) {
...
- copy_page_owner(page, newpage); + folio_copy_owner(folio, newfolio);
This passes old first.
- if (!PageHuge(page)) + if (!folio_test_hugetlb(folio)) mem_cgroup_migrate(folio, newfolio); } -EXPORT_SYMBOL(migrate_page_states); +EXPORT_SYMBOL(folio_migrate_flags);