Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/pagewalk: drop FW_MIGRATION

We removed the last user of FW_MIGRATION in commit 912aa825957f ("Revert
"mm/ksm: convert break_ksm() from walk_page_range_vma() to folio_walk"").

So let's remove FW_MIGRATION and assign FW_ZEROPAGE bit 0. Including
leafops.h is no longer required.

While at it, convert "expose_page" to "zeropage", as zeropages are now the
only remaining use case for not exposing a page.

Link: https://lkml.kernel.org/r/20260227212952.190691-1-david@kernel.org
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Hildenbrand (Arm) and committed by
Andrew Morton
99573ef4 22aa3321

+9 -39
+1 -7
include/linux/pagewalk.h
··· 148 148 149 149 typedef int __bitwise folio_walk_flags_t; 150 150 151 - /* 152 - * Walk migration entries as well. Careful: a large folio might get split 153 - * concurrently. 154 - */ 155 - #define FW_MIGRATION ((__force folio_walk_flags_t)BIT(0)) 156 - 157 151 /* Walk shared zeropages (small + huge) as well. */ 158 - #define FW_ZEROPAGE ((__force folio_walk_flags_t)BIT(1)) 152 + #define FW_ZEROPAGE ((__force folio_walk_flags_t)BIT(0)) 159 153 160 154 enum folio_walk_level { 161 155 FW_LEVEL_PTE,
+8 -32
mm/pagewalk.c
··· 5 5 #include <linux/hugetlb.h> 6 6 #include <linux/mmu_context.h> 7 7 #include <linux/swap.h> 8 - #include <linux/leafops.h> 9 8 10 9 #include <asm/tlbflush.h> 11 10 ··· 840 841 * VM as documented by vm_normal_page(). If requested, zeropages will be 841 842 * returned as well. 842 843 * 843 - * As default, this function only considers present page table entries. 844 - * If requested, it will also consider migration entries. 845 - * 846 844 * If this function returns NULL it might either indicate "there is nothing" or 847 845 * "there is nothing suitable". 848 846 * ··· 850 854 * that call. 851 855 * 852 856 * @fw->page will correspond to the page that is effectively referenced by 853 - * @addr. However, for migration entries and shared zeropages @fw->page is 854 - * set to NULL. Note that large folios might be mapped by multiple page table 855 - * entries, and this function will always only lookup a single entry as 856 - * specified by @addr, which might or might not cover more than a single page of 857 - * the returned folio. 857 + * @addr. However, for shared zeropages @fw->page is set to NULL. Note that 858 + * large folios might be mapped by multiple page table entries, and this 859 + * function will always only lookup a single entry as specified by @addr, which 860 + * might or might not cover more than a single page of the returned folio. 858 861 * 859 862 * This function must *not* be used as a naive replacement for 860 863 * get_user_pages() / pin_user_pages(), especially not to perform DMA or ··· 880 885 folio_walk_flags_t flags) 881 886 { 882 887 unsigned long entry_size; 883 - bool expose_page = true; 888 + bool zeropage = false; 884 889 struct page *page; 885 890 pud_t *pudp, pud; 886 891 pmd_t *pmdp, pmd; ··· 928 933 if (page) 929 934 goto found; 930 935 } 931 - /* 932 - * TODO: FW_MIGRATION support for PUD migration entries 933 - * once there are relevant users. 934 - */ 935 936 spin_unlock(ptl); 936 937 goto not_found; 937 938 } ··· 961 970 } else if ((flags & FW_ZEROPAGE) && 962 971 is_huge_zero_pmd(pmd)) { 963 972 page = pfn_to_page(pmd_pfn(pmd)); 964 - expose_page = false; 973 + zeropage = true; 965 974 goto found; 966 975 } 967 - } else if ((flags & FW_MIGRATION) && 968 - pmd_is_migration_entry(pmd)) { 969 - const softleaf_t entry = softleaf_from_pmd(pmd); 970 - 971 - page = softleaf_to_page(entry); 972 - expose_page = false; 973 - goto found; 974 976 } 975 977 spin_unlock(ptl); 976 978 goto not_found; ··· 988 1004 if ((flags & FW_ZEROPAGE) && 989 1005 is_zero_pfn(pte_pfn(pte))) { 990 1006 page = pfn_to_page(pte_pfn(pte)); 991 - expose_page = false; 992 - goto found; 993 - } 994 - } else if (!pte_none(pte)) { 995 - const softleaf_t entry = softleaf_from_pte(pte); 996 - 997 - if ((flags & FW_MIGRATION) && softleaf_is_migration(entry)) { 998 - page = softleaf_to_page(entry); 999 - expose_page = false; 1007 + zeropage = true; 1000 1008 goto found; 1001 1009 } 1002 1010 } ··· 997 1021 vma_pgtable_walk_end(vma); 998 1022 return NULL; 999 1023 found: 1000 - if (expose_page) 1024 + if (!zeropage) 1001 1025 /* Note: Offset from the mapped page, not the folio start. */ 1002 1026 fw->page = page + ((addr & (entry_size - 1)) >> PAGE_SHIFT); 1003 1027 else