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: rename PAGE_MAPPING_* to FOLIO_MAPPING_*

Now that the mapping flags are only used for folios, let's rename the
defines.

Link: https://lkml.kernel.org/r/20250704102524.326966-27-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: Byungchul Park <byungchul@sk.com>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Eugenio Pé rez <eperezma@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Gregory Price <gourry@gourry.net>
Cc: "Huang, Ying" <ying.huang@linux.alibaba.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Jerrin Shaji George <jerrin.shaji-george@broadcom.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Mathew Brost <matthew.brost@intel.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Peter Xu <peterx@redhat.com>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Rakie Kim <rakie.kim@sk.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: xu xin <xu.xin16@zte.com.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Hildenbrand and committed by
Andrew Morton
df25569d 78cb1a13

+30 -31
+2 -2
fs/proc/page.c
··· 149 149 150 150 k = folio->flags; 151 151 mapping = (unsigned long)folio->mapping; 152 - is_anon = mapping & PAGE_MAPPING_ANON; 152 + is_anon = mapping & FOLIO_MAPPING_ANON; 153 153 154 154 /* 155 155 * pseudo flags for the well known (anonymous) memory mapped pages ··· 158 158 u |= 1 << KPF_MMAP; 159 159 if (is_anon) { 160 160 u |= 1 << KPF_ANON; 161 - if (mapping & PAGE_MAPPING_KSM) 161 + if (mapping & FOLIO_MAPPING_KSM) 162 162 u |= 1 << KPF_KSM; 163 163 } 164 164
+1 -1
include/linux/fs.h
··· 526 526 /* 527 527 * On most architectures that alignment is already the case; but 528 528 * must be enforced here for CRIS, to let the least significant bit 529 - * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON. 529 + * of struct folio's "mapping" pointer be used for FOLIO_MAPPING_ANON. 530 530 */ 531 531 532 532 /* XArray tags, for tagging dirty and writeback pages in the pagecache. */
-1
include/linux/mm_types.h
··· 105 105 unsigned int order; 106 106 }; 107 107 }; 108 - /* See page-flags.h for PAGE_MAPPING_FLAGS */ 109 108 struct address_space *mapping; 110 109 union { 111 110 pgoff_t __folio_index; /* Our offset within mapping. */
+10 -10
include/linux/page-flags.h
··· 695 695 /* 696 696 * On an anonymous folio mapped into a user virtual memory area, 697 697 * folio->mapping points to its anon_vma, not to a struct address_space; 698 - * with the PAGE_MAPPING_ANON bit set to distinguish it. See rmap.h. 698 + * with the FOLIO_MAPPING_ANON bit set to distinguish it. See rmap.h. 699 699 * 700 700 * On an anonymous folio in a VM_MERGEABLE area, if CONFIG_KSM is enabled, 701 - * the PAGE_MAPPING_ANON_KSM bit may be set along with the PAGE_MAPPING_ANON 701 + * the FOLIO_MAPPING_ANON_KSM bit may be set along with the FOLIO_MAPPING_ANON 702 702 * bit; and then folio->mapping points, not to an anon_vma, but to a private 703 703 * structure which KSM associates with that merged folio. See ksm.h. 704 704 * ··· 713 713 * false before calling the following functions (e.g., folio_test_anon). 714 714 * See mm/slab.h. 715 715 */ 716 - #define PAGE_MAPPING_ANON 0x1 717 - #define PAGE_MAPPING_ANON_KSM 0x2 718 - #define PAGE_MAPPING_KSM (PAGE_MAPPING_ANON | PAGE_MAPPING_ANON_KSM) 719 - #define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_ANON_KSM) 716 + #define FOLIO_MAPPING_ANON 0x1 717 + #define FOLIO_MAPPING_ANON_KSM 0x2 718 + #define FOLIO_MAPPING_KSM (FOLIO_MAPPING_ANON | FOLIO_MAPPING_ANON_KSM) 719 + #define FOLIO_MAPPING_FLAGS (FOLIO_MAPPING_ANON | FOLIO_MAPPING_ANON_KSM) 720 720 721 721 static __always_inline bool folio_test_anon(const struct folio *folio) 722 722 { 723 - return ((unsigned long)folio->mapping & PAGE_MAPPING_ANON) != 0; 723 + return ((unsigned long)folio->mapping & FOLIO_MAPPING_ANON) != 0; 724 724 } 725 725 726 726 static __always_inline bool PageAnonNotKsm(const struct page *page) 727 727 { 728 728 unsigned long flags = (unsigned long)page_folio(page)->mapping; 729 729 730 - return (flags & PAGE_MAPPING_FLAGS) == PAGE_MAPPING_ANON; 730 + return (flags & FOLIO_MAPPING_FLAGS) == FOLIO_MAPPING_ANON; 731 731 } 732 732 733 733 static __always_inline bool PageAnon(const struct page *page) ··· 743 743 */ 744 744 static __always_inline bool folio_test_ksm(const struct folio *folio) 745 745 { 746 - return ((unsigned long)folio->mapping & PAGE_MAPPING_FLAGS) == 747 - PAGE_MAPPING_KSM; 746 + return ((unsigned long)folio->mapping & FOLIO_MAPPING_FLAGS) == 747 + FOLIO_MAPPING_KSM; 748 748 } 749 749 #else 750 750 FOLIO_TEST_FLAG_FALSE(ksm)
+1 -1
include/linux/pagemap.h
··· 502 502 static inline bool mapping_large_folio_support(struct address_space *mapping) 503 503 { 504 504 /* AS_FOLIO_ORDER is only reasonable for pagecache folios */ 505 - VM_WARN_ONCE((unsigned long)mapping & PAGE_MAPPING_ANON, 505 + VM_WARN_ONCE((unsigned long)mapping & FOLIO_MAPPING_ANON, 506 506 "Anonymous mapping always supports large folio"); 507 507 508 508 return mapping_max_folio_order(mapping) > 0;
+2 -2
mm/gup.c
··· 2804 2804 return false; 2805 2805 2806 2806 /* Anonymous folios pose no problem. */ 2807 - mapping_flags = (unsigned long)mapping & PAGE_MAPPING_FLAGS; 2807 + mapping_flags = (unsigned long)mapping & FOLIO_MAPPING_FLAGS; 2808 2808 if (mapping_flags) 2809 - return mapping_flags & PAGE_MAPPING_ANON; 2809 + return mapping_flags & FOLIO_MAPPING_ANON; 2810 2810 2811 2811 /* 2812 2812 * At this point, we know the mapping is non-null and points to an
+1 -1
mm/internal.h
··· 149 149 { 150 150 unsigned long mapping = (unsigned long)folio->mapping; 151 151 152 - return (void *)(mapping & ~PAGE_MAPPING_FLAGS); 152 + return (void *)(mapping & ~FOLIO_MAPPING_FLAGS); 153 153 } 154 154 155 155 /*
+2 -2
mm/ksm.c
··· 893 893 unsigned long kpfn; 894 894 895 895 expected_mapping = (void *)((unsigned long)stable_node | 896 - PAGE_MAPPING_KSM); 896 + FOLIO_MAPPING_KSM); 897 897 again: 898 898 kpfn = READ_ONCE(stable_node->kpfn); /* Address dependency. */ 899 899 folio = pfn_folio(kpfn); ··· 1070 1070 struct ksm_stable_node *stable_node) 1071 1071 { 1072 1072 VM_WARN_ON_FOLIO(folio_test_anon(folio) && PageAnonExclusive(&folio->page), folio); 1073 - folio->mapping = (void *)((unsigned long)stable_node | PAGE_MAPPING_KSM); 1073 + folio->mapping = (void *)((unsigned long)stable_node | FOLIO_MAPPING_KSM); 1074 1074 } 1075 1075 1076 1076 #ifdef CONFIG_SYSFS
+8 -8
mm/rmap.c
··· 503 503 504 504 rcu_read_lock(); 505 505 anon_mapping = (unsigned long)READ_ONCE(folio->mapping); 506 - if ((anon_mapping & PAGE_MAPPING_FLAGS) != PAGE_MAPPING_ANON) 506 + if ((anon_mapping & FOLIO_MAPPING_FLAGS) != FOLIO_MAPPING_ANON) 507 507 goto out; 508 508 if (!folio_mapped(folio)) 509 509 goto out; 510 510 511 - anon_vma = (struct anon_vma *) (anon_mapping - PAGE_MAPPING_ANON); 511 + anon_vma = (struct anon_vma *) (anon_mapping - FOLIO_MAPPING_ANON); 512 512 if (!atomic_inc_not_zero(&anon_vma->refcount)) { 513 513 anon_vma = NULL; 514 514 goto out; ··· 550 550 retry: 551 551 rcu_read_lock(); 552 552 anon_mapping = (unsigned long)READ_ONCE(folio->mapping); 553 - if ((anon_mapping & PAGE_MAPPING_FLAGS) != PAGE_MAPPING_ANON) 553 + if ((anon_mapping & FOLIO_MAPPING_FLAGS) != FOLIO_MAPPING_ANON) 554 554 goto out; 555 555 if (!folio_mapped(folio)) 556 556 goto out; 557 557 558 - anon_vma = (struct anon_vma *) (anon_mapping - PAGE_MAPPING_ANON); 558 + anon_vma = (struct anon_vma *) (anon_mapping - FOLIO_MAPPING_ANON); 559 559 root_anon_vma = READ_ONCE(anon_vma->root); 560 560 if (down_read_trylock(&root_anon_vma->rwsem)) { 561 561 /* ··· 1334 1334 VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); 1335 1335 VM_BUG_ON_VMA(!anon_vma, vma); 1336 1336 1337 - anon_vma += PAGE_MAPPING_ANON; 1337 + anon_vma += FOLIO_MAPPING_ANON; 1338 1338 /* 1339 - * Ensure that anon_vma and the PAGE_MAPPING_ANON bit are written 1339 + * Ensure that anon_vma and the FOLIO_MAPPING_ANON bit are written 1340 1340 * simultaneously, so a concurrent reader (eg folio_referenced()'s 1341 1341 * folio_test_anon()) will not see one without the other. 1342 1342 */ ··· 1367 1367 /* 1368 1368 * page_idle does a lockless/optimistic rmap scan on folio->mapping. 1369 1369 * Make sure the compiler doesn't split the stores of anon_vma and 1370 - * the PAGE_MAPPING_ANON type identifier, otherwise the rmap code 1370 + * the FOLIO_MAPPING_ANON type identifier, otherwise the rmap code 1371 1371 * could mistake the mapping for a struct address_space and crash. 1372 1372 */ 1373 - anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; 1373 + anon_vma = (void *) anon_vma + FOLIO_MAPPING_ANON; 1374 1374 WRITE_ONCE(folio->mapping, (struct address_space *) anon_vma); 1375 1375 folio->index = linear_page_index(vma, address); 1376 1376 }
+3 -3
mm/util.c
··· 670 670 { 671 671 unsigned long mapping = (unsigned long)folio->mapping; 672 672 673 - if ((mapping & PAGE_MAPPING_FLAGS) != PAGE_MAPPING_ANON) 673 + if ((mapping & FOLIO_MAPPING_FLAGS) != FOLIO_MAPPING_ANON) 674 674 return NULL; 675 - return (void *)(mapping - PAGE_MAPPING_ANON); 675 + return (void *)(mapping - FOLIO_MAPPING_ANON); 676 676 } 677 677 678 678 /** ··· 699 699 return swap_address_space(folio->swap); 700 700 701 701 mapping = folio->mapping; 702 - if ((unsigned long)mapping & PAGE_MAPPING_FLAGS) 702 + if ((unsigned long)mapping & FOLIO_MAPPING_FLAGS) 703 703 return NULL; 704 704 705 705 return mapping;