hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/8489 -------------------------------- This reverts commit 5c20a4adee2784f68d06b8a7c5d39dea49004e2e. Commit 5c20a4adee27 ("arm64: mm: Add copy mc support for migrate_page") adds copy mc support for both normal pages and hugetlb in page migration. However, hugetlb is not enabled for page migration. So we can revert it. Signed-off-by: Qi Xi <xiqi2@huawei.com> --- mm/migrate.c | 79 ++++++---------------------------------------------- 1 file changed, 9 insertions(+), 70 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 83f95fa8f4c5..f8c379a0b9b9 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -47,7 +47,6 @@ #include <linux/page_owner.h> #include <linux/sched/mm.h> #include <linux/ptrace.h> -#include <linux/highmem.h> #include <asm/tlbflush.h> @@ -641,33 +640,24 @@ int migrate_huge_page_move_mapping(struct address_space *mapping, * arithmetic will work across the entire page. We need something more * specialized. */ -static int __copy_gigantic_page(struct page *dst, struct page *src, - int nr_pages, bool mc) +static void __copy_gigantic_page(struct page *dst, struct page *src, + int nr_pages) { - int i, ret = 0; + int i; struct page *dst_base = dst; struct page *src_base = src; for (i = 0; i < nr_pages; ) { cond_resched(); - - if (mc) { - ret = copy_mc_highpage(dst, src); - if (ret) - return -EFAULT; - } else { - copy_highpage(dst, src); - } + copy_highpage(dst, src); i++; dst = mem_map_next(dst, dst_base, i); src = mem_map_next(src, src_base, i); } - - return ret; } -static int __copy_huge_page(struct page *dst, struct page *src, bool mc) +static void copy_huge_page(struct page *dst, struct page *src) { int i; int nr_pages; @@ -677,32 +667,20 @@ static int __copy_huge_page(struct page *dst, struct page *src, bool mc) struct hstate *h = page_hstate(src); nr_pages = pages_per_huge_page(h); - if (unlikely(nr_pages > MAX_ORDER_NR_PAGES)) - return __copy_gigantic_page(dst, src, nr_pages, mc); + if (unlikely(nr_pages > MAX_ORDER_NR_PAGES)) { + __copy_gigantic_page(dst, src, nr_pages); + return; + } } else { /* thp page */ BUG_ON(!PageTransHuge(src)); nr_pages = hpage_nr_pages(src); } - if (mc) - return copy_mc_highpages(dst, src, nr_pages); - for (i = 0; i < nr_pages; i++) { cond_resched(); copy_highpage(dst + i, src + i); } - return 0; -} - -static int copy_huge_page(struct page *dst, struct page *src) -{ - return __copy_huge_page(dst, src, false); -} - -static int copy_mc_huge_page(struct page *dst, struct page *src) -{ - return __copy_huge_page(dst, src, true); } /* @@ -778,38 +756,6 @@ void migrate_page_copy(struct page *newpage, struct page *page) } EXPORT_SYMBOL(migrate_page_copy); -static int migrate_page_copy_mc(struct page *newpage, struct page *page) -{ - int rc; - - if (PageHuge(page) || PageTransHuge(page)) - rc = copy_mc_huge_page(newpage, page); - else - rc = copy_mc_highpage(newpage, page); - - return rc; -} - -static int migrate_page_mc_extra(struct address_space *mapping, - struct page *newpage, struct page *page, - enum migrate_mode mode, int extra_count) -{ - int rc; - - rc = migrate_page_copy_mc(newpage, page); - if (rc) - return rc; - - rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode, - extra_count); - if (rc != MIGRATEPAGE_SUCCESS) - return rc; - - migrate_page_states(newpage, page); - - return rc; -} - /************************************************************ * Migration functions ***********************************************************/ @@ -828,13 +774,6 @@ int migrate_page(struct address_space *mapping, BUG_ON(PageWriteback(page)); /* Writeback must be complete */ -#ifdef CONFIG_UCE_KERNEL_RECOVERY - if (IS_ENABLED(CONFIG_ARM64) && - is_cow_kernel_recovery_enable() && - (mode != MIGRATE_SYNC_NO_COPY)) - return migrate_page_mc_extra(mapping, newpage, page, mode, 0); -#endif - rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode, 0); if (rc != MIGRATEPAGE_SUCCESS) -- 2.33.0