mm-convert-migrate_pages-to-work-on-folios.patch removed from -mm tree
The quilt patch titled
Subject: mm: convert migrate_pages() to work on folios
has been removed from the -mm tree. Its filename was
mm-convert-migrate_pages-to-work-on-folios.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: convert migrate_pages() to work on folios
Date: Sat, 13 May 2023 01:11:01 +0100
Almost all of the callers & implementors of migrate_pages() were already converted to use folios. compaction_alloc() & compaction_free() are trivial to convert a part of this patch and not worth splitting out.
---
Documentation/mm/page_migration.rst | 7 Documentation/translations/zh_CN/mm/page_migration.rst | 2 include/linux/migrate.h | 16 mm/compaction.c | 15 mm/mempolicy.c | 15 mm/migrate.c | 161 ++++------ mm/vmscan.c | 15 7 files changed, 108 insertions(+), 123 deletions(-)
Documentation/mm/page_migration.rst renamed from Documentation/mm/page_migration.rst~mm-convert-migrate_pages-to-work-on-folios +3 -4
@@ -73,14 +73,13 @@ In kernel use of migrate_pages() It also prevents the swapper or other scans from encountering the page. -2. We need to have a function of type new_page_t that can be +2. We need to have a function of type new_folio_t that can be passed to migrate_pages(). This function should figure out - how to allocate the correct new page given the old page. + how to allocate the correct new folio given the old folio. 3. The migrate_pages() function is called which attempts to do the migration. It will call the function to allocate - the new page for each page that is considered for - moving. + the new folio for each folio that is considered for moving. How migrate_pages() works =========================
Documentation/translations/zh_CN/mm/page_migration.rst renamed from Documentation/translations/zh_CN/mm/page_migration.rst~mm-convert-migrate_pages-to-work-on-folios +1 -1
@@ -55,7 +55,7 @@ 在内核中使用 migrate_pages() 消失。它还可以防止交换器或其他扫描器遇到该页。 -2. 我们需要有一个new_page_t类型的函数,可以传递给migrate_pages()。这个函数应该计算 +2. 我们需要有一个new_folio_t类型的函数,可以传递给migrate_pages()。这个函数应该计算 出如何在给定的旧页面中分配正确的新页面。 3. migrate_pages()函数被调用,它试图进行迁移。它将调用该函数为每个被考虑迁移的页面分
include/linux/migrate.h renamed from include/linux/migrate.h~mm-convert-migrate_pages-to-work-on-folios +8 -8
@@ -7,8 +7,8 @@#include <linux/migrate_mode.h> #include <linux/hugetlb.h> -typedef struct page *new_page_t (struct page *page,unsigned long private); -typedef void free_page_t (struct page *page,unsigned long private); +typedef struct folio *new_folio_t (struct folio *folio,unsigned long private); +typedef void free_folio_t (struct folio *folio,unsigned long private);struct migration_target_control ;
@@ -67,10 +67,10 @@ int migrate_folio_extra(struct address_s struct folio *src, enum migrate_mode mode, int extra_count);int migrate_folio (struct address_space *mapping,struct folio *dst,struct folio *src,enum migrate_mode mode); -int migrate_pages (struct list_head *l,new_page_t new,free_page_t free, +int migrate_pages (struct list_head *l,new_folio_t new,free_folio_t free,unsigned long private,enum migrate_mode mode,int reason,unsigned int *ret_succeeded); -struct page *alloc_migration_target (struct page *page,unsigned long private); +struct folio *alloc_migration_target (struct folio *src,unsigned long private);bool isolate_movable_page (struct page *page,isolate_mode_t mode); int migrate_huge_page_move_mapping(struct address_space *mapping,
@@ -85,11 +85,11 @@ int folio_migrate_mapping(struct address#else static inline void putback_movable_pages (struct list_head *l) {} -static inline int migrate_pages (struct list_head *l,new_page_t new, -free_page_t free,unsigned long private,enum migrate_mode mode, -int reason,unsigned int *ret_succeeded) +static inline int migrate_pages (struct list_head *l,new_folio_t new, +free_folio_t free,unsigned long private, +enum migrate_mode mode,int reason,unsigned int *ret_succeeded) {return -ENOSYS ; } -static inline struct page *alloc_migration_target (struct page *page, +static inline struct folio *alloc_migration_target (struct folio *src,unsigned long private) {return NULL ; }static inline bool isolate_movable_page (struct page *page,isolate_mode_t mode)
mm/compaction.c renamed from mm/compaction.c~mm-convert-migrate_pages-to-work-on-folios +7 -8
@@ -1685,11 +1685,10 @@ splitmap:* This is a migrate-callback that "allocates" freepages by taking pages * from the isolated freelists in the block we are migrating to. */ -static struct page *compaction_alloc (struct page *migratepage, -unsigned long data) +static struct folio *compaction_alloc (struct folio *src,unsigned long data) {struct compact_control *cc = (struct compact_control *)data; -struct page *freepage; +struct folio *dst;if (list_empty (&cc->freepages)) {isolate_freepages (cc);
@@ -1698,11 +1697,11 @@ static struct page *compaction_alloc(strreturn NULL ; } - freepage = list_entry(cc->freepages.next, struct page, lru); -list_del (&freepage->lru); + dst = list_entry(cc->freepages.next, struct folio, lru); +list_del (&dst->lru); cc->nr_freepages--; -return freepage; +return dst; }/*
@@ -1710,11 +1709,11 @@ static struct page *compaction_alloc(str* freelist. All pages on the freelist are from the same zone, so there is no * special handling needed for NUMA. */ -static void compaction_free (struct page *page,unsigned long data) +static void compaction_free (struct folio *dst,unsigned long data) {struct compact_control *cc = (struct compact_control *)data; -list_add (&page->lru, &cc->freepages); +list_add (&dst->lru, &cc->freepages); cc->nr_freepages++; }
mm/mempolicy.c renamed from mm/mempolicy.c~mm-convert-migrate_pages-to-work-on-folios +6 -9
@@ -1195,24 +1195,22 @@ int do_migrate_pages(struct mm_struct *m* list of pages handed to migrate_pages()--which is how we get here-- * is in virtual address order. */ -static struct page *new_page (struct page *page,unsigned long start) +static struct folio *new_folio (struct folio *src,unsigned long start) { -struct folio *dst, *src =page_folio (page);struct vm_area_struct *vma;unsigned long address;VMA_ITERATOR (vmi, current->mm, start);gfp_t gfp =GFP_HIGHUSER_MOVABLE | __GFP_RETRY_MAYFAIL;for_each_vma (vmi, vma) { - address =page_address_in_vma (page, vma); + address =page_address_in_vma (&src->page, vma);if (address != -EFAULT )break ; }if (folio_test_hugetlb (src)) { - dst =alloc_hugetlb_folio_vma (folio_hstate (src), +return alloc_hugetlb_folio_vma (folio_hstate (src), vma, address); -return &dst->page; }if (folio_test_large (src))
@@ -1221,9 +1219,8 @@ static struct page *new_page(struct page/* * if !vma, vma_alloc_folio() will use task or system default policy */ - dst =vma_alloc_folio (gfp,folio_order (src), vma, address, +return vma_alloc_folio (gfp,folio_order (src), vma, address, folio_test_large(src)); - return &dst->page; }#else
@@ -1239,7 +1236,7 @@ int do_migrate_pages(struct mm_struct *mreturn -ENOSYS ; } -static struct page *new_page (struct page *page,unsigned long start) +static struct folio *new_folio (struct folio *src,unsigned long start) {return NULL ; }
@@ -1334,7 +1331,7 @@ static long do_mbind(unsigned long startif (!list_empty (&pagelist)) {WARN_ON_ONCE (flags &MPOL_MF_LAZY ); - nr_failed =migrate_pages (&pagelist, new_page,NULL , + nr_failed =migrate_pages (&pagelist, new_folio,NULL , start,MIGRATE_SYNC ,MR_MEMPOLICY_MBIND ,NULL );if (nr_failed)putback_movable_pages (&pagelist);
mm/migrate.c renamed from mm/migrate.c~mm-convert-migrate_pages-to-work-on-folios +75 -86
378 lines not on this page · raw message
mm/vmscan.c renamed from mm/vmscan.c~mm-convert-migrate_pages-to-work-on-folios +8 -7
@@ -1621,9 +1621,10 @@ static void folio_check_dirty_writeback( mapping->a_ops->is_dirty_writeback (folio, dirty, writeback); } -static struct page *alloc_demote_page (struct page *page,unsigned long private) +static struct folio *alloc_demote_folio (struct folio *src, +unsigned long private) { -struct page *target_page; +struct folio *dst;nodemask_t *allowed_mask;struct migration_target_control *mtc;
@@ -1641,14 +1642,14 @@ static struct page *alloc_demote_page(st*/ mtc->nmask =NULL ; mtc->gfp_mask |= __GFP_THISNODE; - target_page =alloc_migration_target (page, (unsigned long )mtc); -if (target_page) -return target_page; + dst =alloc_migration_target (src, (unsigned long )mtc); +if (dst) +return dst; mtc->gfp_mask &= ~__GFP_THISNODE; mtc->nmask = allowed_mask; -return alloc_migration_target (page, (unsigned long )mtc); +return alloc_migration_target (src, (unsigned long )mtc); }/*
@@ -1683,7 +1684,7 @@ static unsigned int demote_folio_list(stnode_get_allowed_targets (pgdat, &allowed_mask);/* Demotion ignores all cpuset and mempolicy settings */ -migrate_pages (demote_folios, alloc_demote_page,NULL , +migrate_pages (demote_folios, alloc_demote_folio,NULL , (unsigned long )&mtc,MIGRATE_ASYNC ,MR_DEMOTION , &nr_succeeded);
_
Patches currently in -mm which might be from [email protected] are