History

mm: introduce memdesc_flags_t

Patch series "Add and use memdesc_flags_t". At some point struct page will be separated from struct slab and struct folio. This is a step towards that by introducing a type for the 'flags' word of all three structures. This gives us a certain amount of type safety by establishing that some of these unsigned longs are different from other unsigned longs in that they contain things like node ID, section number and zone number in the upper bits. That lets us have functions that can be easily called by anyone who has a slab, folio or page (but not easily by anyone else) to get the node or zone. There's going to be some unusual merge problems with this as some odd bits of the kernel decide they want to print out the flags value or something similar by writing page->flags and now they'll need to write page->flags.f instead. That's most of the churn here. Maybe we should be removing these things from the debug output? This patch (of 11): Wrap the unsigned long flags in a typedef. In upcoming patches, this will provide a strong hint that you can't just pass a random unsigned long to functions which take this as an argument. [willy@infradead.org: s/flags/flags.f/ in several architectures] Link: https://lkml.kernel.org/r/aKMgPRLD-WnkPxYm@casper.infradead.org [nicola.vetrini@gmail.com: mips: fix compilation error] Link: https://lore.kernel.org/lkml/CA+G9fYvkpmqGr6wjBNHY=dRp71PLCoi2341JxOudi60yqaeUdg@mail.gmail.com/ Link: https://lkml.kernel.org/r/20250825214245.1838158-1-nicola.vetrini@gmail.com Link: https://lkml.kernel.org/r/20250805172307.1302730-1-willy@infradead.org Link: https://lkml.kernel.org/r/20250805172307.1302730-2-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Acked-by: Zi Yan <ziy@nvidia.com> Cc: Shakeel Butt <shakeel.butt@linux.dev> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Matthew Wilcox (Oracle) committed 1 year ago

Commit 53fbef51 parent 4e9156558 files · +195 −190Browse files

Unified · Split

58 files
  1. arch/arc/mm/cache.c +4 −4
  2. arch/arc/mm/tlb.c +1 −1
  3. arch/arm/include/asm/hugetlb.h +1 −1
  4. arch/arm/mm/copypage-v4mc.c +1 −1
  5. arch/arm/mm/copypage-v6.c +1 −1
  6. arch/arm/mm/copypage-xscale.c +1 −1
  7. arch/arm/mm/dma-mapping.c +1 −1
  8. arch/arm/mm/fault-armv.c +1 −1
  9. arch/arm/mm/flush.c +5 −5
  10. arch/arm64/include/asm/hugetlb.h +3 −3
  11. arch/arm64/include/asm/mte.h +8 −8
  12. arch/arm64/mm/flush.c +4 −4
  13. arch/csky/abiv1/cacheflush.c +3 −3
  14. arch/mips/include/asm/cacheflush.h +3 −3
  15. arch/nios2/mm/cacheflush.c +3 −3
  16. arch/openrisc/include/asm/cacheflush.h +1 −1
  17. arch/openrisc/mm/cache.c +1 −1
  18. arch/parisc/kernel/cache.c +3 −3
  19. arch/powerpc/include/asm/cacheflush.h +2 −2
  20. arch/powerpc/include/asm/kvm_ppc.h +2 −2
  21. arch/powerpc/mm/book3s64/hash_utils.c +2 −2
  22. arch/powerpc/mm/pgtable.c +6 −6
  23. arch/riscv/include/asm/cacheflush.h +2 −2
  24. arch/riscv/include/asm/hugetlb.h +1 −1
  25. arch/riscv/mm/cacheflush.c +2 −2
  26. arch/s390/include/asm/hugetlb.h +1 −1
  27. arch/s390/kernel/uv.c +6 −6
  28. arch/s390/mm/gmap.c +1 −1
  29. arch/s390/mm/hugetlbpage.c +1 −1
  30. arch/sh/include/asm/hugetlb.h +1 −1
  31. arch/sh/mm/cache-sh4.c +1 −1
  32. arch/sh/mm/cache-sh7705.c +1 −1
  33. arch/sh/mm/cache.c +7 −7
  34. arch/sh/mm/kmap.c +1 −1
  35. arch/sparc/mm/init_64.c +5 −5
  36. arch/x86/mm/pat/memtype.c +3 −3
  37. arch/xtensa/mm/cache.c +6 −6
  38. fs/fuse/dev.c +1 −1
  39. fs/gfs2/glops.c +1 −1
  40. fs/jffs2/file.c +2 −2
  41. fs/nilfs2/page.c +1 −1
  42. fs/proc/page.c +2 −2
  43. fs/ubifs/file.c +3 −3
  44. include/linux/mm.h +16 −16
  45. include/linux/mm_inline.h +6 −6
  46. include/linux/mm_types.h +6 −2
  47. include/linux/mmzone.h +1 −1
  48. include/linux/page-flags.h +20 −20
  49. include/linux/pgalloc_tag.h +4 −3
  50. include/trace/events/page_ref.h +2 −2
  51. mm/filemap.c +4 −4
  52. mm/huge_memory.c +2 −2
  53. mm/memory-failure.c +6 −6
  54. mm/mmzone.c +2 −2
  55. mm/page_alloc.c +6 −6
  56. mm/swap.c +4 −4
  57. mm/vmscan.c +9 −9
  58. mm/workingset.c +1 −1
arch/arc/mm/cache.c+4−4
@@ -704,7 +704,7 @@ static inline void arc_slc_enable(void) · 703 unmodified lines
704704
705705 void flush_dcache_folio(struct folio *folio)
706706 {
707− clear_bit(PG_dc_clean, &folio->flags);
707+ clear_bit(PG_dc_clean, &folio->flags.f);
708708 return;
709709 }
710710 EXPORT_SYMBOL(flush_dcache_folio);
@@ -889,8 +889,8 @@ void copy_user_highpage(struct page *to, struct page *from, · 178 unmodified lines
889889
890890 copy_page(kto, kfrom);
891891
892− clear_bit(PG_dc_clean, &dst->flags);
893− clear_bit(PG_dc_clean, &src->flags);
892+ clear_bit(PG_dc_clean, &dst->flags.f);
893+ clear_bit(PG_dc_clean, &src->flags.f);
894894
895895 kunmap_atomic(kto);
896896 kunmap_atomic(kfrom);
@@ -900,7 +900,7 @@ void clear_user_page(void *to, unsigned long u_vaddr, struct page *page) · 3 unmodified lines
900900 {
901901 struct folio *folio = page_folio(page);
902902 clear_page(to);
903− clear_bit(PG_dc_clean, &folio->flags);
903+ clear_bit(PG_dc_clean, &folio->flags.f);
904904 }
905905 EXPORT_SYMBOL(clear_user_page);
906906
arch/arc/mm/tlb.c+1−1
@@ -488,7 +488,7 @@ void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma, · 487 unmodified lines
488488 */
489489 if (vma->vm_flags & VM_EXEC) {
490490 struct folio *folio = page_folio(page);
491− int dirty = !test_and_set_bit(PG_dc_clean, &folio->flags);
491+ int dirty = !test_and_set_bit(PG_dc_clean, &folio->flags.f);
492492 if (dirty) {
493493 unsigned long offset = offset_in_folio(folio, paddr);
494494 nr = folio_nr_pages(folio);
arch/arm/include/asm/hugetlb.h+1−1
@@ -17,7 +17,7 @@ · 16 unmodified lines
1717
1818 static inline void arch_clear_hugetlb_flags(struct folio *folio)
1919 {
20− clear_bit(PG_dcache_clean, &folio->flags);
20+ clear_bit(PG_dcache_clean, &folio->flags.f);
2121 }
2222 #define arch_clear_hugetlb_flags arch_clear_hugetlb_flags
2323
arch/arm/mm/copypage-v4mc.c+1−1
@@ -67,7 +67,7 @@ void v4_mc_copy_user_highpage(struct page *to, struct page *from, · 66 unmodified lines
6767 struct folio *src = page_folio(from);
6868 void *kto = kmap_atomic(to);
6969
70− if (!test_and_set_bit(PG_dcache_clean, &src->flags))
70+ if (!test_and_set_bit(PG_dcache_clean, &src->flags.f))
7171 __flush_dcache_folio(folio_flush_mapping(src), src);
7272
7373 raw_spin_lock(&minicache_lock);
arch/arm/mm/copypage-v6.c+1−1
@@ -73,7 +73,7 @@ static void v6_copy_user_highpage_aliasing(struct page *to, · 72 unmodified lines
7373 unsigned int offset = CACHE_COLOUR(vaddr);
7474 unsigned long kfrom, kto;
7575
76− if (!test_and_set_bit(PG_dcache_clean, &src->flags))
76+ if (!test_and_set_bit(PG_dcache_clean, &src->flags.f))
7777 __flush_dcache_folio(folio_flush_mapping(src), src);
7878
7979 /* FIXME: not highmem safe */
arch/arm/mm/copypage-xscale.c+1−1
@@ -87,7 +87,7 @@ void xscale_mc_copy_user_highpage(struct page *to, struct page *from, · 86 unmodified lines
8787 struct folio *src = page_folio(from);
8888 void *kto = kmap_atomic(to);
8989
90− if (!test_and_set_bit(PG_dcache_clean, &src->flags))
90+ if (!test_and_set_bit(PG_dcache_clean, &src->flags.f))
9191 __flush_dcache_folio(folio_flush_mapping(src), src);
9292
9393 raw_spin_lock(&minicache_lock);
arch/arm/mm/dma-mapping.c+1−1
@@ -718,7 +718,7 @@ static void __dma_page_dev_to_cpu(struct page *page, unsigned long off, · 717 unmodified lines
718718 if (size < sz)
719719 break;
720720 if (!offset)
721− set_bit(PG_dcache_clean, &folio->flags);
721+ set_bit(PG_dcache_clean, &folio->flags.f);
722722 offset = 0;
723723 size -= sz;
724724 if (!size)
arch/arm/mm/fault-armv.c+1−1
@@ -203,7 +203,7 @@ void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma, · 202 unmodified lines
203203
204204 folio = page_folio(pfn_to_page(pfn));
205205 mapping = folio_flush_mapping(folio);
206− if (!test_and_set_bit(PG_dcache_clean, &folio->flags))
206+ if (!test_and_set_bit(PG_dcache_clean, &folio->flags.f))
207207 __flush_dcache_folio(mapping, folio);
208208 if (mapping) {
209209 if (cache_is_vivt())
arch/arm/mm/flush.c+5−5
@@ -304,7 +304,7 @@ void __sync_icache_dcache(pte_t pteval) · 303 unmodified lines
304304 else
305305 mapping = NULL;
306306
307− if (!test_and_set_bit(PG_dcache_clean, &folio->flags))
307+ if (!test_and_set_bit(PG_dcache_clean, &folio->flags.f))
308308 __flush_dcache_folio(mapping, folio);
309309
310310 if (pte_exec(pteval))
@@ -343,8 +343,8 @@ void flush_dcache_folio(struct folio *folio) · 32 unmodified lines
343343 return;
344344
345345 if (!cache_ops_need_broadcast() && cache_is_vipt_nonaliasing()) {
346− if (test_bit(PG_dcache_clean, &folio->flags))
347− clear_bit(PG_dcache_clean, &folio->flags);
346+ if (test_bit(PG_dcache_clean, &folio->flags.f))
347+ clear_bit(PG_dcache_clean, &folio->flags.f);
348348 return;
349349 }
350350
@@ -352,14 +352,14 @@ void flush_dcache_folio(struct folio *folio) · 1 unmodified line
352352
353353 if (!cache_ops_need_broadcast() &&
354354 mapping && !folio_mapped(folio))
355− clear_bit(PG_dcache_clean, &folio->flags);
355+ clear_bit(PG_dcache_clean, &folio->flags.f);
356356 else {
357357 __flush_dcache_folio(mapping, folio);
358358 if (mapping && cache_is_vivt())
359359 __flush_dcache_aliases(mapping, folio);
360360 else if (mapping)
361361 __flush_icache_all();
362− set_bit(PG_dcache_clean, &folio->flags);
362+ set_bit(PG_dcache_clean, &folio->flags.f);
363363 }
364364 }
365365 EXPORT_SYMBOL(flush_dcache_folio);
arch/arm64/include/asm/hugetlb.h+3−3
@@ -21,12 +21,12 @@ extern bool arch_hugetlb_migration_supported(struct hstate *h); · 20 unmodified lines
2121
2222 static inline void arch_clear_hugetlb_flags(struct folio *folio)
2323 {
24− clear_bit(PG_dcache_clean, &folio->flags);
24+ clear_bit(PG_dcache_clean, &folio->flags.f);
2525
2626 #ifdef CONFIG_ARM64_MTE
2727 if (system_supports_mte()) {
28− clear_bit(PG_mte_tagged, &folio->flags);
29− clear_bit(PG_mte_lock, &folio->flags);
28+ clear_bit(PG_mte_tagged, &folio->flags.f);
29+ clear_bit(PG_mte_lock, &folio->flags.f);
3030 }
3131 #endif
3232 }
arch/arm64/include/asm/mte.h+8−8
@@ -48,12 +48,12 @@ static inline void set_page_mte_tagged(struct page *page) · 47 unmodified lines
4848 * before the page flags update.
4949 */
5050 smp_wmb();
51− set_bit(PG_mte_tagged, &page->flags);
51+ set_bit(PG_mte_tagged, &page->flags.f);
5252 }
5353
5454 static inline bool page_mte_tagged(struct page *page)
5555 {
56− bool ret = test_bit(PG_mte_tagged, &page->flags);
56+ bool ret = test_bit(PG_mte_tagged, &page->flags.f);
5757
5858 VM_WARN_ON_ONCE(folio_test_hugetlb(page_folio(page)));
5959
@@ -82,7 +82,7 @@ static inline bool try_page_mte_tagging(struct page *page) · 22 unmodified lines
8282 {
8383 VM_WARN_ON_ONCE(folio_test_hugetlb(page_folio(page)));
8484
85− if (!test_and_set_bit(PG_mte_lock, &page->flags))
85+ if (!test_and_set_bit(PG_mte_lock, &page->flags.f))
8686 return true;
8787
8888 /*
@@ -90,7 +90,7 @@ static inline bool try_page_mte_tagging(struct page *page) · 1 unmodified line
9090 * already. Check if the PG_mte_tagged flag has been set or wait
9191 * otherwise.
9292 */
93− smp_cond_load_acquire(&page->flags, VAL & (1UL << PG_mte_tagged));
93+ smp_cond_load_acquire(&page->flags.f, VAL & (1UL << PG_mte_tagged));
9494
9595 return false;
9696 }
@@ -173,13 +173,13 @@ static inline void folio_set_hugetlb_mte_tagged(struct folio *folio) · 76 unmodified lines
173173 * before the folio flags update.
174174 */
175175 smp_wmb();
176− set_bit(PG_mte_tagged, &folio->flags);
176+ set_bit(PG_mte_tagged, &folio->flags.f);
177177
178178 }
179179
180180 static inline bool folio_test_hugetlb_mte_tagged(struct folio *folio)
181181 {
182− bool ret = test_bit(PG_mte_tagged, &folio->flags);
182+ bool ret = test_bit(PG_mte_tagged, &folio->flags.f);
183183
184184 VM_WARN_ON_ONCE(!folio_test_hugetlb(folio));
185185
@@ -196,7 +196,7 @@ static inline bool folio_try_hugetlb_mte_tagging(struct folio *folio) · 10 unmodified lines
196196 {
197197 VM_WARN_ON_ONCE(!folio_test_hugetlb(folio));
198198
199− if (!test_and_set_bit(PG_mte_lock, &folio->flags))
199+ if (!test_and_set_bit(PG_mte_lock, &folio->flags.f))
200200 return true;
201201
202202 /*
@@ -204,7 +204,7 @@ static inline bool folio_try_hugetlb_mte_tagging(struct folio *folio) · 1 unmodified line
204204 * already. Check if the PG_mte_tagged flag has been set or wait
205205 * otherwise.
206206 */
207− smp_cond_load_acquire(&folio->flags, VAL & (1UL << PG_mte_tagged));
207+ smp_cond_load_acquire(&folio->flags.f, VAL & (1UL << PG_mte_tagged));
208208
209209 return false;
210210 }
arch/arm64/mm/flush.c+4−4
@@ -53,11 +53,11 @@ void __sync_icache_dcache(pte_t pte) · 52 unmodified lines
5353 {
5454 struct folio *folio = page_folio(pte_page(pte));
5555
56− if (!test_bit(PG_dcache_clean, &folio->flags)) {
56+ if (!test_bit(PG_dcache_clean, &folio->flags.f)) {
5757 sync_icache_aliases((unsigned long)folio_address(folio),
5858 (unsigned long)folio_address(folio) +
5959 folio_size(folio));
60− set_bit(PG_dcache_clean, &folio->flags);
60+ set_bit(PG_dcache_clean, &folio->flags.f);
6161 }
6262 }
6363 EXPORT_SYMBOL_GPL(__sync_icache_dcache);
@@ -69,8 +69,8 @@ EXPORT_SYMBOL_GPL(__sync_icache_dcache); · 5 unmodified lines
6969 */
7070 void flush_dcache_folio(struct folio *folio)
7171 {
72− if (test_bit(PG_dcache_clean, &folio->flags))
73− clear_bit(PG_dcache_clean, &folio->flags);
72+ if (test_bit(PG_dcache_clean, &folio->flags.f))
73+ clear_bit(PG_dcache_clean, &folio->flags.f);
7474 }
7575 EXPORT_SYMBOL(flush_dcache_folio);
7676
arch/csky/abiv1/cacheflush.c+3−3
@@ -25,12 +25,12 @@ void flush_dcache_folio(struct folio *folio) · 24 unmodified lines
2525 mapping = folio_flush_mapping(folio);
2626
2727 if (mapping && !folio_mapped(folio))
28− clear_bit(PG_dcache_clean, &folio->flags);
28+ clear_bit(PG_dcache_clean, &folio->flags.f);
2929 else {
3030 dcache_wbinv_all();
3131 if (mapping)
3232 icache_inv_all();
33− set_bit(PG_dcache_clean, &folio->flags);
33+ set_bit(PG_dcache_clean, &folio->flags.f);
3434 }
3535 }
3636 EXPORT_SYMBOL(flush_dcache_folio);
@@ -56,7 +56,7 @@ void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma, · 19 unmodified lines
5656 return;
5757
5858 folio = page_folio(pfn_to_page(pfn));
59− if (!test_and_set_bit(PG_dcache_clean, &folio->flags))
59+ if (!test_and_set_bit(PG_dcache_clean, &folio->flags.f))
6060 dcache_wbinv_all();
6161
6262 if (folio_flush_mapping(folio)) {
arch/mips/include/asm/cacheflush.h+3−3
@@ -37,11 +37,11 @@ · 36 unmodified lines
3737 #define PG_dcache_dirty PG_arch_1
3838
3939 #define folio_test_dcache_dirty(folio) \
40− test_bit(PG_dcache_dirty, &(folio)->flags)
40+ test_bit(PG_dcache_dirty, &(folio)->flags.f)
4141 #define folio_set_dcache_dirty(folio) \
42− set_bit(PG_dcache_dirty, &(folio)->flags)
42+ set_bit(PG_dcache_dirty, &(folio)->flags.f)
4343 #define folio_clear_dcache_dirty(folio) \
44− clear_bit(PG_dcache_dirty, &(folio)->flags)
44+ clear_bit(PG_dcache_dirty, &(folio)->flags.f)
4545
4646 extern void (*flush_cache_all)(void);
4747 extern void (*__flush_cache_all)(void);
arch/nios2/mm/cacheflush.c+3−3
@@ -187,7 +187,7 @@ void flush_dcache_folio(struct folio *folio) · 186 unmodified lines
187187
188188 /* Flush this page if there are aliases. */
189189 if (mapping && !mapping_mapped(mapping)) {
190− clear_bit(PG_dcache_clean, &folio->flags);
190+ clear_bit(PG_dcache_clean, &folio->flags.f);
191191 } else {
192192 __flush_dcache_folio(folio);
193193 if (mapping) {
@@ -195,7 +195,7 @@ void flush_dcache_folio(struct folio *folio) · 1 unmodified line
195195 flush_aliases(mapping, folio);
196196 flush_icache_range(start, start + folio_size(folio));
197197 }
198− set_bit(PG_dcache_clean, &folio->flags);
198+ set_bit(PG_dcache_clean, &folio->flags.f);
199199 }
200200 }
201201 EXPORT_SYMBOL(flush_dcache_folio);
@@ -227,7 +227,7 @@ void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma, · 25 unmodified lines
227227 return;
228228
229229 folio = page_folio(pfn_to_page(pfn));
230− if (!test_and_set_bit(PG_dcache_clean, &folio->flags))
230+ if (!test_and_set_bit(PG_dcache_clean, &folio->flags.f))
231231 __flush_dcache_folio(folio);
232232
233233 mapping = folio_flush_mapping(folio);
arch/openrisc/include/asm/cacheflush.h+1−1
@@ -75,7 +75,7 @@ static inline void sync_icache_dcache(struct page *page) · 74 unmodified lines
7575
7676 static inline void flush_dcache_folio(struct folio *folio)
7777 {
78− clear_bit(PG_dc_clean, &folio->flags);
78+ clear_bit(PG_dc_clean, &folio->flags.f);
7979 }
8080 #define flush_dcache_folio flush_dcache_folio
8181
arch/openrisc/mm/cache.c+1−1
@@ -83,7 +83,7 @@ void update_cache(struct vm_area_struct *vma, unsigned long address, · 82 unmodified lines
8383 {
8484 unsigned long pfn = pte_val(*pte) >> PAGE_SHIFT;
8585 struct folio *folio = page_folio(pfn_to_page(pfn));
86− int dirty = !test_and_set_bit(PG_dc_clean, &folio->flags);
86+ int dirty = !test_and_set_bit(PG_dc_clean, &folio->flags.f);
8787
8888 /*
8989 * Since icaches do not snoop for updated data on OpenRISC, we
arch/parisc/kernel/cache.c+3−3
@@ -122,10 +122,10 @@ void __update_cache(pte_t pte) · 121 unmodified lines
122122 pfn = folio_pfn(folio);
123123 nr = folio_nr_pages(folio);
124124 if (folio_flush_mapping(folio) &&
125− test_bit(PG_dcache_dirty, &folio->flags)) {
125+ test_bit(PG_dcache_dirty, &folio->flags.f)) {
126126 while (nr--)
127127 flush_kernel_dcache_page_addr(pfn_va(pfn + nr));
128− clear_bit(PG_dcache_dirty, &folio->flags);
128+ clear_bit(PG_dcache_dirty, &folio->flags.f);
129129 } else if (parisc_requires_coherency())
130130 while (nr--)
131131 flush_kernel_dcache_page_addr(pfn_va(pfn + nr));
@@ -481,7 +481,7 @@ void flush_dcache_folio(struct folio *folio) · 349 unmodified lines
481481 pgoff_t pgoff;
482482
483483 if (mapping && !mapping_mapped(mapping)) {
484− set_bit(PG_dcache_dirty, &folio->flags);
484+ set_bit(PG_dcache_dirty, &folio->flags.f);
485485 return;
486486 }
487487
arch/powerpc/include/asm/cacheflush.h+2−2
@@ -40,8 +40,8 @@ static inline void flush_dcache_folio(struct folio *folio) · 39 unmodified lines
4040 if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
4141 return;
4242 /* avoid an atomic op if possible */
43− if (test_bit(PG_dcache_clean, &folio->flags))
44− clear_bit(PG_dcache_clean, &folio->flags);
43+ if (test_bit(PG_dcache_clean, &folio->flags.f))
44+ clear_bit(PG_dcache_clean, &folio->flags.f);
4545 }
4646 #define flush_dcache_folio flush_dcache_folio
4747
arch/powerpc/include/asm/kvm_ppc.h+2−2
@@ -939,9 +939,9 @@ static inline void kvmppc_mmu_flush_icache(kvm_pfn_t pfn) · 938 unmodified lines
939939
940940 /* Clear i-cache for new pages */
941941 folio = page_folio(pfn_to_page(pfn));
942− if (!test_bit(PG_dcache_clean, &folio->flags)) {
942+ if (!test_bit(PG_dcache_clean, &folio->flags.f)) {
943943 flush_dcache_icache_folio(folio);
944− set_bit(PG_dcache_clean, &folio->flags);
944+ set_bit(PG_dcache_clean, &folio->flags.f);
945945 }
946946 }
947947
arch/powerpc/mm/book3s64/hash_utils.c+2−2
@@ -1562,11 +1562,11 @@ unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap) · 1561 unmodified lines
15621562 folio = page_folio(pte_page(pte));
15631563
15641564 /* page is dirty */
1565− if (!test_bit(PG_dcache_clean, &folio->flags) &&
1565+ if (!test_bit(PG_dcache_clean, &folio->flags.f) &&
15661566 !folio_test_reserved(folio)) {
15671567 if (trap == INTERRUPT_INST_STORAGE) {
15681568 flush_dcache_icache_folio(folio);
1569− set_bit(PG_dcache_clean, &folio->flags);
1569+ set_bit(PG_dcache_clean, &folio->flags.f);
15701570 } else
15711571 pp |= HPTE_R_N;
15721572 }
arch/powerpc/mm/pgtable.c+6−6
@@ -87,9 +87,9 @@ static pte_t set_pte_filter_hash(pte_t pte, unsigned long addr) · 86 unmodified lines
8787 struct folio *folio = maybe_pte_to_folio(pte);
8888 if (!folio)
8989 return pte;
90− if (!test_bit(PG_dcache_clean, &folio->flags)) {
90+ if (!test_bit(PG_dcache_clean, &folio->flags.f)) {
9191 flush_dcache_icache_folio(folio);
92− set_bit(PG_dcache_clean, &folio->flags);
92+ set_bit(PG_dcache_clean, &folio->flags.f);
9393 }
9494 }
9595 return pte;
@@ -127,13 +127,13 @@ static inline pte_t set_pte_filter(pte_t pte, unsigned long addr) · 31 unmodified lines
127127 return pte;
128128
129129 /* If the page clean, we move on */
130− if (test_bit(PG_dcache_clean, &folio->flags))
130+ if (test_bit(PG_dcache_clean, &folio->flags.f))
131131 return pte;
132132
133133 /* If it's an exec fault, we flush the cache and make it clean */
134134 if (is_exec_fault()) {
135135 flush_dcache_icache_folio(folio);
136− set_bit(PG_dcache_clean, &folio->flags);
136+ set_bit(PG_dcache_clean, &folio->flags.f);
137137 return pte;
138138 }
139139
@@ -175,12 +175,12 @@ static pte_t set_access_flags_filter(pte_t pte, struct vm_area_struct *vma, · 35 unmodified lines
175175 goto bail;
176176
177177 /* If the page is already clean, we move on */
178− if (test_bit(PG_dcache_clean, &folio->flags))
178+ if (test_bit(PG_dcache_clean, &folio->flags.f))
179179 goto bail;
180180
181181 /* Clean the page and set PG_dcache_clean */
182182 flush_dcache_icache_folio(folio);
183− set_bit(PG_dcache_clean, &folio->flags);
183+ set_bit(PG_dcache_clean, &folio->flags.f);
184184
185185 bail:
186186 return pte_mkexec(pte);
arch/riscv/include/asm/cacheflush.h+2−2
@@ -23,8 +23,8 @@ static inline void local_flush_icache_range(unsigned long start, · 22 unmodified lines
2323
2424 static inline void flush_dcache_folio(struct folio *folio)
2525 {
26− if (test_bit(PG_dcache_clean, &folio->flags))
27− clear_bit(PG_dcache_clean, &folio->flags);
26+ if (test_bit(PG_dcache_clean, &folio->flags.f))
27+ clear_bit(PG_dcache_clean, &folio->flags.f);
2828 }
2929 #define flush_dcache_folio flush_dcache_folio
3030 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
arch/riscv/include/asm/hugetlb.h+1−1
@@ -7,7 +7,7 @@ · 6 unmodified lines
77
88 static inline void arch_clear_hugetlb_flags(struct folio *folio)
99 {
10− clear_bit(PG_dcache_clean, &folio->flags);
10+ clear_bit(PG_dcache_clean, &folio->flags.f);
1111 }
1212 #define arch_clear_hugetlb_flags arch_clear_hugetlb_flags
1313
arch/riscv/mm/cacheflush.c+2−2
@@ -101,9 +101,9 @@ void flush_icache_pte(struct mm_struct *mm, pte_t pte) · 100 unmodified lines
101101 {
102102 struct folio *folio = page_folio(pte_page(pte));
103103
104− if (!test_bit(PG_dcache_clean, &folio->flags)) {
104+ if (!test_bit(PG_dcache_clean, &folio->flags.f)) {
105105 flush_icache_mm(mm, false);
106− set_bit(PG_dcache_clean, &folio->flags);
106+ set_bit(PG_dcache_clean, &folio->flags.f);
107107 }
108108 }
109109 #endif /* CONFIG_MMU */
arch/s390/include/asm/hugetlb.h+1−1
@@ -39,7 +39,7 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, · 38 unmodified lines
3939
4040 static inline void arch_clear_hugetlb_flags(struct folio *folio)
4141 {
42− clear_bit(PG_arch_1, &folio->flags);
42+ clear_bit(PG_arch_1, &folio->flags.f);
4343 }
4444 #define arch_clear_hugetlb_flags arch_clear_hugetlb_flags
4545
arch/s390/kernel/uv.c+6−6
@@ -144,7 +144,7 @@ int uv_destroy_folio(struct folio *folio) · 143 unmodified lines
144144 folio_get(folio);
145145 rc = uv_destroy(folio_to_phys(folio));
146146 if (!rc)
147− clear_bit(PG_arch_1, &folio->flags);
147+ clear_bit(PG_arch_1, &folio->flags.f);
148148 folio_put(folio);
149149 return rc;
150150 }
@@ -193,7 +193,7 @@ int uv_convert_from_secure_folio(struct folio *folio) · 42 unmodified lines
193193 folio_get(folio);
194194 rc = uv_convert_from_secure(folio_to_phys(folio));
195195 if (!rc)
196− clear_bit(PG_arch_1, &folio->flags);
196+ clear_bit(PG_arch_1, &folio->flags.f);
197197 folio_put(folio);
198198 return rc;
199199 }
@@ -289,7 +289,7 @@ static int __make_folio_secure(struct folio *folio, struct uv_cb_header *uvcb) · 89 unmodified lines
289289 expected = expected_folio_refs(folio) + 1;
290290 if (!folio_ref_freeze(folio, expected))
291291 return -EBUSY;
292− set_bit(PG_arch_1, &folio->flags);
292+ set_bit(PG_arch_1, &folio->flags.f);
293293 /*
294294 * If the UVC does not succeed or fail immediately, we don't want to
295295 * loop for long, or we might get stall notifications.
@@ -483,18 +483,18 @@ int arch_make_folio_accessible(struct folio *folio) · 187 unmodified lines
483483 * convert_to_secure.
484484 * As secure pages are never large folios, both variants can co-exists.
485485 */
486− if (!test_bit(PG_arch_1, &folio->flags))
486+ if (!test_bit(PG_arch_1, &folio->flags.f))
487487 return 0;
488488
489489 rc = uv_pin_shared(folio_to_phys(folio));
490490 if (!rc) {
491− clear_bit(PG_arch_1, &folio->flags);
491+ clear_bit(PG_arch_1, &folio->flags.f);
492492 return 0;
493493 }
494494
495495 rc = uv_convert_from_secure(folio_to_phys(folio));
496496 if (!rc) {
497− clear_bit(PG_arch_1, &folio->flags);
497+ clear_bit(PG_arch_1, &folio->flags.f);
498498 return 0;
499499 }
500500
arch/s390/mm/gmap.c+1−1
@@ -2272,7 +2272,7 @@ static int __s390_enable_skey_hugetlb(pte_t *pte, unsigned long addr, · 2271 unmodified lines
22722272 start = pmd_val(*pmd) & HPAGE_MASK;
22732273 end = start + HPAGE_SIZE;
22742274 __storage_key_init_range(start, end);
2275− set_bit(PG_arch_1, &folio->flags);
2275+ set_bit(PG_arch_1, &folio->flags.f);
22762276 cond_resched();
22772277 return 0;
22782278 }
arch/s390/mm/hugetlbpage.c+1−1
@@ -155,7 +155,7 @@ static void clear_huge_pte_skeys(struct mm_struct *mm, unsigned long rste) · 154 unmodified lines
155155 paddr = rste & PMD_MASK;
156156 }
157157
158− if (!test_and_set_bit(PG_arch_1, &folio->flags))
158+ if (!test_and_set_bit(PG_arch_1, &folio->flags.f))
159159 __storage_key_init_range(paddr, paddr + size);
160160 }
161161
arch/sh/include/asm/hugetlb.h+1−1
@@ -14,7 +14,7 @@ static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma, · 13 unmodified lines
1414
1515 static inline void arch_clear_hugetlb_flags(struct folio *folio)
1616 {
17− clear_bit(PG_dcache_clean, &folio->flags);
17+ clear_bit(PG_dcache_clean, &folio->flags.f);
1818 }
1919 #define arch_clear_hugetlb_flags arch_clear_hugetlb_flags
2020
arch/sh/mm/cache-sh4.c+1−1
@@ -114,7 +114,7 @@ static void sh4_flush_dcache_folio(void *arg) · 113 unmodified lines
114114 struct address_space *mapping = folio_flush_mapping(folio);
115115
116116 if (mapping && !mapping_mapped(mapping))
117− clear_bit(PG_dcache_clean, &folio->flags);
117+ clear_bit(PG_dcache_clean, &folio->flags.f);
118118 else
119119 #endif
120120 {
arch/sh/mm/cache-sh7705.c+1−1
@@ -138,7 +138,7 @@ static void sh7705_flush_dcache_folio(void *arg) · 137 unmodified lines
138138 struct address_space *mapping = folio_flush_mapping(folio);
139139
140140 if (mapping && !mapping_mapped(mapping))
141− clear_bit(PG_dcache_clean, &folio->flags);
141+ clear_bit(PG_dcache_clean, &folio->flags.f);
142142 else {
143143 unsigned long pfn = folio_pfn(folio);
144144 unsigned int i, nr = folio_nr_pages(folio);
arch/sh/mm/cache.c+7−7
@@ -64,14 +64,14 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page, · 63 unmodified lines
6464 struct folio *folio = page_folio(page);
6565
6666 if (boot_cpu_data.dcache.n_aliases && folio_mapped(folio) &&
67− test_bit(PG_dcache_clean, &folio->flags)) {
67+ test_bit(PG_dcache_clean, &folio->flags.f)) {
6868 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
6969 memcpy(vto, src, len);
7070 kunmap_coherent(vto);
7171 } else {
7272 memcpy(dst, src, len);
7373 if (boot_cpu_data.dcache.n_aliases)
74− clear_bit(PG_dcache_clean, &folio->flags);
74+ clear_bit(PG_dcache_clean, &folio->flags.f);
7575 }
7676
7777 if (vma->vm_flags & VM_EXEC)
@@ -85,14 +85,14 @@ void copy_from_user_page(struct vm_area_struct *vma, struct page *page, · 7 unmodified lines
8585 struct folio *folio = page_folio(page);
8686
8787 if (boot_cpu_data.dcache.n_aliases && folio_mapped(folio) &&
88− test_bit(PG_dcache_clean, &folio->flags)) {
88+ test_bit(PG_dcache_clean, &folio->flags.f)) {
8989 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
9090 memcpy(dst, vfrom, len);
9191 kunmap_coherent(vfrom);
9292 } else {
9393 memcpy(dst, src, len);
9494 if (boot_cpu_data.dcache.n_aliases)
95− clear_bit(PG_dcache_clean, &folio->flags);
95+ clear_bit(PG_dcache_clean, &folio->flags.f);
9696 }
9797 }
9898
@@ -105,7 +105,7 @@ void copy_user_highpage(struct page *to, struct page *from, · 6 unmodified lines
105105 vto = kmap_atomic(to);
106106
107107 if (boot_cpu_data.dcache.n_aliases && folio_mapped(src) &&
108− test_bit(PG_dcache_clean, &src->flags)) {
108+ test_bit(PG_dcache_clean, &src->flags.f)) {
109109 vfrom = kmap_coherent(from, vaddr);
110110 copy_page(vto, vfrom);
111111 kunmap_coherent(vfrom);
@@ -148,7 +148,7 @@ void __update_cache(struct vm_area_struct *vma, · 36 unmodified lines
148148
149149 if (pfn_valid(pfn)) {
150150 struct folio *folio = page_folio(pfn_to_page(pfn));
151− int dirty = !test_and_set_bit(PG_dcache_clean, &folio->flags);
151+ int dirty = !test_and_set_bit(PG_dcache_clean, &folio->flags.f);
152152 if (dirty)
153153 __flush_purge_region(folio_address(folio),
154154 folio_size(folio));
@@ -162,7 +162,7 @@ void __flush_anon_page(struct page *page, unsigned long vmaddr) · 7 unmodified lines
162162
163163 if (pages_do_alias(addr, vmaddr)) {
164164 if (boot_cpu_data.dcache.n_aliases && folio_mapped(folio) &&
165− test_bit(PG_dcache_clean, &folio->flags)) {
165+ test_bit(PG_dcache_clean, &folio->flags.f)) {
166166 void *kaddr;
167167
168168 kaddr = kmap_coherent(page, vmaddr);
arch/sh/mm/kmap.c+1−1
@@ -31,7 +31,7 @@ void *kmap_coherent(struct page *page, unsigned long addr) · 30 unmodified lines
3131 enum fixed_addresses idx;
3232 unsigned long vaddr;
3333
34− BUG_ON(!test_bit(PG_dcache_clean, &folio->flags));
34+ BUG_ON(!test_bit(PG_dcache_clean, &folio->flags.f));
3535
3636 preempt_disable();
3737 pagefault_disable();
arch/sparc/mm/init_64.c+5−5
@@ -224,7 +224,7 @@ inline void flush_dcache_folio_impl(struct folio *folio) · 223 unmodified lines
224224 ((1UL<<ilog2(roundup_pow_of_two(NR_CPUS)))-1UL)
225225
226226 #define dcache_dirty_cpu(folio) \
227− (((folio)->flags >> PG_dcache_cpu_shift) & PG_dcache_cpu_mask)
227+ (((folio)->flags.f >> PG_dcache_cpu_shift) & PG_dcache_cpu_mask)
228228
229229 static inline void set_dcache_dirty(struct folio *folio, int this_cpu)
230230 {
@@ -243,7 +243,7 @@ static inline void set_dcache_dirty(struct folio *folio, int this_cpu) · 12 unmodified lines
243243 "bne,pn %%xcc, 1b\n\t"
244244 " nop"
245245 : /* no outputs */
246− : "r" (mask), "r" (non_cpu_bits), "r" (&folio->flags)
246+ : "r" (mask), "r" (non_cpu_bits), "r" (&folio->flags.f)
247247 : "g1", "g7");
248248 }
249249
@@ -265,7 +265,7 @@ static inline void clear_dcache_dirty_cpu(struct folio *folio, unsigned long cpu · 15 unmodified lines
265265 " nop\n"
266266 "2:"
267267 : /* no outputs */
268− : "r" (cpu), "r" (mask), "r" (&folio->flags),
268+ : "r" (cpu), "r" (mask), "r" (&folio->flags.f),
269269 "i" (PG_dcache_cpu_mask),
270270 "i" (PG_dcache_cpu_shift)
271271 : "g1", "g7");
@@ -292,7 +292,7 @@ static void flush_dcache(unsigned long pfn) · 20 unmodified lines
292292 struct folio *folio = page_folio(page);
293293 unsigned long pg_flags;
294294
295− pg_flags = folio->flags;
295+ pg_flags = folio->flags.f;
296296 if (pg_flags & (1UL << PG_dcache_dirty)) {
297297 int cpu = ((pg_flags >> PG_dcache_cpu_shift) &
298298 PG_dcache_cpu_mask);
@@ -480,7 +480,7 @@ void flush_dcache_folio(struct folio *folio) · 181 unmodified lines
480480
481481 mapping = folio_flush_mapping(folio);
482482 if (mapping && !mapping_mapped(mapping)) {
483− bool dirty = test_bit(PG_dcache_dirty, &folio->flags);
483+ bool dirty = test_bit(PG_dcache_dirty, &folio->flags.f);
484484 if (dirty) {
485485 int dirty_cpu = dcache_dirty_cpu(folio);
486486
arch/x86/mm/pat/memtype.c+3−3
@@ -126,7 +126,7 @@ __setup("debugpat", pat_debug_setup); · 125 unmodified lines
126126
127127 static inline enum page_cache_mode get_page_memtype(struct page *pg)
128128 {
129− unsigned long pg_flags = pg->flags & _PGMT_MASK;
129+ unsigned long pg_flags = pg->flags.f & _PGMT_MASK;
130130
131131 if (pg_flags == _PGMT_WB)
132132 return _PAGE_CACHE_MODE_WB;
@@ -161,10 +161,10 @@ static inline void set_page_memtype(struct page *pg, · 28 unmodified lines
161161 break;
162162 }
163163
164− old_flags = READ_ONCE(pg->flags);
164+ old_flags = READ_ONCE(pg->flags.f);
165165 do {
166166 new_flags = (old_flags & _PGMT_CLEAR_MASK) | memtype_flags;
167− } while (!try_cmpxchg(&pg->flags, &old_flags, new_flags));
167+ } while (!try_cmpxchg(&pg->flags.f, &old_flags, new_flags));
168168 }
169169 #else
170170 static inline enum page_cache_mode get_page_memtype(struct page *pg)
arch/xtensa/mm/cache.c+6−6
@@ -134,8 +134,8 @@ void flush_dcache_folio(struct folio *folio) · 133 unmodified lines
134134 */
135135
136136 if (mapping && !mapping_mapped(mapping)) {
137− if (!test_bit(PG_arch_1, &folio->flags))
138− set_bit(PG_arch_1, &folio->flags);
137+ if (!test_bit(PG_arch_1, &folio->flags.f))
138+ set_bit(PG_arch_1, &folio->flags.f);
139139 return;
140140
141141 } else {
@@ -232,7 +232,7 @@ void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma, · 90 unmodified lines
232232
233233 #if (DCACHE_WAY_SIZE > PAGE_SIZE)
234234
235− if (!folio_test_reserved(folio) && test_bit(PG_arch_1, &folio->flags)) {
235+ if (!folio_test_reserved(folio) && test_bit(PG_arch_1, &folio->flags.f)) {
236236 unsigned long phys = folio_pfn(folio) * PAGE_SIZE;
237237 unsigned long tmp;
238238
@@ -247,10 +247,10 @@ void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma, · 8 unmodified lines
247247 }
248248 preempt_enable();
249249
250− clear_bit(PG_arch_1, &folio->flags);
250+ clear_bit(PG_arch_1, &folio->flags.f);
251251 }
252252 #else
253− if (!folio_test_reserved(folio) && !test_bit(PG_arch_1, &folio->flags)
253+ if (!folio_test_reserved(folio) && !test_bit(PG_arch_1, &folio->flags.f)
254254 && (vma->vm_flags & VM_EXEC) != 0) {
255255 for (i = 0; i < nr; i++) {
256256 void *paddr = kmap_local_folio(folio, i * PAGE_SIZE);
@@ -258,7 +258,7 @@ void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma, · 1 unmodified line
258258 __invalidate_icache_page((unsigned long)paddr);
259259 kunmap_local(paddr);
260260 }
261− set_bit(PG_arch_1, &folio->flags);
261+ set_bit(PG_arch_1, &folio->flags.f);
262262 }
263263 #endif
264264 }
fs/fuse/dev.c+1−1
@@ -935,7 +935,7 @@ static int fuse_check_folio(struct folio *folio) · 934 unmodified lines
935935 {
936936 if (folio_mapped(folio) ||
937937 folio->mapping != NULL ||
938− (folio->flags & PAGE_FLAGS_CHECK_AT_PREP &
938+ (folio->flags.f & PAGE_FLAGS_CHECK_AT_PREP &
939939 ~(1 << PG_locked |
940940 1 << PG_referenced |
941941 1 << PG_lru |
fs/gfs2/glops.c+1−1
@@ -40,7 +40,7 @@ static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh) · 39 unmodified lines
4040 "AIL buffer %p: blocknr %llu state 0x%08lx mapping %p page "
4141 "state 0x%lx\n",
4242 bh, (unsigned long long)bh->b_blocknr, bh->b_state,
43− bh->b_folio->mapping, bh->b_folio->flags);
43+ bh->b_folio->mapping, bh->b_folio->flags.f);
4444 fs_err(sdp, "AIL glock %u:%llu mapping %p\n",
4545 gl->gl_name.ln_type, gl->gl_name.ln_number,
4646 gfs2_glock2aspace(gl));
fs/jffs2/file.c+2−2
@@ -230,7 +230,7 @@ static int jffs2_write_begin(const struct kiocb *iocb, · 229 unmodified lines
230230 goto release_sem;
231231 }
232232 }
233− jffs2_dbg(1, "end write_begin(). folio->flags %lx\n", folio->flags);
233+ jffs2_dbg(1, "end write_begin(). folio->flags %lx\n", folio->flags.f);
234234
235235 release_sem:
236236 mutex_unlock(&c->alloc_sem);
@@ -259,7 +259,7 @@ static int jffs2_write_end(const struct kiocb *iocb, · 22 unmodified lines
259259
260260 jffs2_dbg(1, "%s(): ino #%lu, page at 0x%llx, range %d-%d, flags %lx\n",
261261 __func__, inode->i_ino, folio_pos(folio),
262− start, end, folio->flags);
262+ start, end, folio->flags.f);
263263
264264 /* We need to avoid deadlock with page_cache_read() in
265265 jffs2_garbage_collect_pass(). So the folio must be
fs/nilfs2/page.c+1−1
@@ -167,7 +167,7 @@ void nilfs_folio_bug(struct folio *folio) · 166 unmodified lines
167167 printk(KERN_CRIT "NILFS_FOLIO_BUG(%p): cnt=%d index#=%llu flags=0x%lx "
168168 "mapping=%p ino=%lu\n",
169169 folio, folio_ref_count(folio),
170− (unsigned long long)folio->index, folio->flags, m, ino);
170+ (unsigned long long)folio->index, folio->flags.f, m, ino);
171171
172172 head = folio_buffers(folio);
173173 if (head) {
fs/proc/page.c+2−2
@@ -163,7 +163,7 @@ u64 stable_page_flags(const struct page *page) · 162 unmodified lines
163163 snapshot_page(&ps, page);
164164 folio = &ps.folio_snapshot;
165165
166− k = folio->flags;
166+ k = folio->flags.f;
167167 mapping = (unsigned long)folio->mapping;
168168 is_anon = mapping & FOLIO_MAPPING_ANON;
169169
@@ -238,7 +238,7 @@ u64 stable_page_flags(const struct page *page) · 68 unmodified lines
238238 if (u & (1 << KPF_HUGE))
239239 u |= kpf_copy_bit(k, KPF_HWPOISON, PG_hwpoison);
240240 else
241− u |= kpf_copy_bit(ps.page_snapshot.flags, KPF_HWPOISON, PG_hwpoison);
241+ u |= kpf_copy_bit(ps.page_snapshot.flags.f, KPF_HWPOISON, PG_hwpoison);
242242 #endif
243243
244244 u |= kpf_copy_bit(k, KPF_RESERVED, PG_reserved);
fs/ubifs/file.c+3−3
@@ -107,7 +107,7 @@ static int do_readpage(struct folio *folio) · 106 unmodified lines
107107 size_t offset = 0;
108108
109109 dbg_gen("ino %lu, pg %lu, i_size %lld, flags %#lx",
110− inode->i_ino, folio->index, i_size, folio->flags);
110+ inode->i_ino, folio->index, i_size, folio->flags.f);
111111 ubifs_assert(c, !folio_test_checked(folio));
112112 ubifs_assert(c, !folio->private);
113113
@@ -600,7 +600,7 @@ static int populate_page(struct ubifs_info *c, struct folio *folio, · 486 unmodified lines
600600 pgoff_t end_index;
601601
602602 dbg_gen("ino %lu, pg %lu, i_size %lld, flags %#lx",
603− inode->i_ino, folio->index, i_size, folio->flags);
603+ inode->i_ino, folio->index, i_size, folio->flags.f);
604604
605605 end_index = (i_size - 1) >> PAGE_SHIFT;
606606 if (!i_size || folio->index > end_index) {
@@ -988,7 +988,7 @@ static int ubifs_writepage(struct folio *folio, struct writeback_control *wbc) · 381 unmodified lines
988988 int err, len = folio_size(folio);
989989
990990 dbg_gen("ino %lu, pg %lu, pg flags %#lx",
991− inode->i_ino, folio->index, folio->flags);
991+ inode->i_ino, folio->index, folio->flags.f);
992992 ubifs_assert(c, folio->private != NULL);
993993
994994 /* Is the folio fully outside @i_size? (truncate in progress) */
include/linux/mm.h+16−16
@@ -1024,7 +1024,7 @@ static inline unsigned int compound_order(struct page *page) · 1023 unmodified lines
10241024 {
10251025 struct folio *folio = (struct folio *)page;
10261026
1027− if (!test_bit(PG_head, &folio->flags))
1027+ if (!test_bit(PG_head, &folio->flags.f))
10281028 return 0;
10291029 return folio_large_order(folio);
10301030 }
@@ -1554,7 +1554,7 @@ static inline bool is_nommu_shared_mapping(vm_flags_t flags) · 523 unmodified lines
15541554 */
15551555 static inline int page_zone_id(struct page *page)
15561556 {
1557− return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK;
1557+ return (page->flags.f >> ZONEID_PGSHIFT) & ZONEID_MASK;
15581558 }
15591559
15601560 #ifdef NODE_NOT_IN_PAGE_FLAGS
@@ -1562,7 +1562,7 @@ int page_to_nid(const struct page *page); · 1 unmodified line
15621562 #else
15631563 static inline int page_to_nid(const struct page *page)
15641564 {
1565− return (PF_POISONED_CHECK(page)->flags >> NODES_PGSHIFT) & NODES_MASK;
1565+ return (PF_POISONED_CHECK(page)->flags.f >> NODES_PGSHIFT) & NODES_MASK;
15661566 }
15671567 #endif
15681568
@@ -1637,14 +1637,14 @@ static inline void page_cpupid_reset_last(struct page *page) · 68 unmodified lines
16371637 #else
16381638 static inline int folio_last_cpupid(struct folio *folio)
16391639 {
1640− return (folio->flags >> LAST_CPUPID_PGSHIFT) & LAST_CPUPID_MASK;
1640+ return (folio->flags.f >> LAST_CPUPID_PGSHIFT) & LAST_CPUPID_MASK;
16411641 }
16421642
16431643 int folio_xchg_last_cpupid(struct folio *folio, int cpupid);
16441644
16451645 static inline void page_cpupid_reset_last(struct page *page)
16461646 {
1647− page->flags |= LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT;
1647+ page->flags.f |= LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT;
16481648 }
16491649 #endif /* LAST_CPUPID_NOT_IN_PAGE_FLAGS */
16501650
@@ -1740,7 +1740,7 @@ static inline u8 page_kasan_tag(const struct page *page) · 89 unmodified lines
17401740 u8 tag = KASAN_TAG_KERNEL;
17411741
17421742 if (kasan_enabled()) {
1743− tag = (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK;
1743+ tag = (page->flags.f >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK;
17441744 tag ^= 0xff;
17451745 }
17461746
@@ -1755,12 +1755,12 @@ static inline void page_kasan_tag_set(struct page *page, u8 tag) · 8 unmodified lines
17551755 return;
17561756
17571757 tag ^= 0xff;
1758− old_flags = READ_ONCE(page->flags);
1758+ old_flags = READ_ONCE(page->flags.f);
17591759 do {
17601760 flags = old_flags;
17611761 flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT);
17621762 flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT;
1763− } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags)));
1763+ } while (unlikely(!try_cmpxchg(&page->flags.f, &old_flags, flags)));
17641764 }
17651765
17661766 static inline void page_kasan_tag_reset(struct page *page)
@@ -1804,13 +1804,13 @@ static inline pg_data_t *folio_pgdat(const struct folio *folio) · 37 unmodified lines
18041804 #ifdef SECTION_IN_PAGE_FLAGS
18051805 static inline void set_page_section(struct page *page, unsigned long section)
18061806 {
1807− page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT);
1808− page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
1807+ page->flags.f &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT);
1808+ page->flags.f |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
18091809 }
18101810
18111811 static inline unsigned long page_to_section(const struct page *page)
18121812 {
1813− return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
1813+ return (page->flags.f >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
18141814 }
18151815 #endif
18161816
@@ -2015,14 +2015,14 @@ static inline bool folio_is_longterm_pinnable(struct folio *folio) · 198 unmodified lines
20152015
20162016 static inline void set_page_zone(struct page *page, enum zone_type zone)
20172017 {
2018− page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);
2019− page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT;
2018+ page->flags.f &= ~(ZONES_MASK << ZONES_PGSHIFT);
2019+ page->flags.f |= (zone & ZONES_MASK) << ZONES_PGSHIFT;
20202020 }
20212021
20222022 static inline void set_page_node(struct page *page, unsigned long node)
20232023 {
2024− page->flags &= ~(NODES_MASK << NODES_PGSHIFT);
2025− page->flags |= (node & NODES_MASK) << NODES_PGSHIFT;
2024+ page->flags.f &= ~(NODES_MASK << NODES_PGSHIFT);
2025+ page->flags.f |= (node & NODES_MASK) << NODES_PGSHIFT;
20262026 }
20272027
20282028 static inline void set_page_links(struct page *page, enum zone_type zone,
@@ -2064,7 +2064,7 @@ static inline long compound_nr(struct page *page) · 35 unmodified lines
20642064 {
20652065 struct folio *folio = (struct folio *)page;
20662066
2067− if (!test_bit(PG_head, &folio->flags))
2067+ if (!test_bit(PG_head, &folio->flags.f))
20682068 return 1;
20692069 return folio_large_nr_pages(folio);
20702070 }
include/linux/mm_inline.h+6−6
@@ -143,7 +143,7 @@ static inline int lru_tier_from_refs(int refs, bool workingset) · 142 unmodified lines
143143
144144 static inline int folio_lru_refs(struct folio *folio)
145145 {
146− unsigned long flags = READ_ONCE(folio->flags);
146+ unsigned long flags = READ_ONCE(folio->flags.f);
147147
148148 if (!(flags & BIT(PG_referenced)))
149149 return 0;
@@ -156,7 +156,7 @@ static inline int folio_lru_refs(struct folio *folio) · 6 unmodified lines
156156
157157 static inline int folio_lru_gen(struct folio *folio)
158158 {
159− unsigned long flags = READ_ONCE(folio->flags);
159+ unsigned long flags = READ_ONCE(folio->flags.f);
160160
161161 return ((flags & LRU_GEN_MASK) >> LRU_GEN_PGOFF) - 1;
162162 }
@@ -268,7 +268,7 @@ static inline bool lru_gen_add_folio(struct lruvec *lruvec, struct folio *folio, · 105 unmodified lines
268268 gen = lru_gen_from_seq(seq);
269269 flags = (gen + 1UL) << LRU_GEN_PGOFF;
270270 /* see the comment on MIN_NR_GENS about PG_active */
271− set_mask_bits(&folio->flags, LRU_GEN_MASK | BIT(PG_active), flags);
271+ set_mask_bits(&folio->flags.f, LRU_GEN_MASK | BIT(PG_active), flags);
272272
273273 lru_gen_update_size(lruvec, folio, -1, gen);
274274 /* for folio_rotate_reclaimable() */
@@ -293,7 +293,7 @@ static inline bool lru_gen_del_folio(struct lruvec *lruvec, struct folio *folio, · 18 unmodified lines
293293
294294 /* for folio_migrate_flags() */
295295 flags = !reclaiming && lru_gen_is_active(lruvec, gen) ? BIT(PG_active) : 0;
296− flags = set_mask_bits(&folio->flags, LRU_GEN_MASK, flags);
296+ flags = set_mask_bits(&folio->flags.f, LRU_GEN_MASK, flags);
297297 gen = ((flags & LRU_GEN_MASK) >> LRU_GEN_PGOFF) - 1;
298298
299299 lru_gen_update_size(lruvec, folio, gen, -1);
@@ -304,9 +304,9 @@ static inline bool lru_gen_del_folio(struct lruvec *lruvec, struct folio *folio, · 4 unmodified lines
304304
305305 static inline void folio_migrate_refs(struct folio *new, struct folio *old)
306306 {
307− unsigned long refs = READ_ONCE(old->flags) & LRU_REFS_MASK;
307+ unsigned long refs = READ_ONCE(old->flags.f) & LRU_REFS_MASK;
308308
309− set_mask_bits(&new->flags, LRU_REFS_MASK, refs);
309+ set_mask_bits(&new->flags.f, LRU_REFS_MASK, refs);
310310 }
311311 #else /* !CONFIG_LRU_GEN */
312312
include/linux/mm_types.h+6−2
@@ -34,6 +34,10 @@ struct address_space; · 33 unmodified lines
3434 struct futex_private_hash;
3535 struct mem_cgroup;
3636
37+typedef struct {
38+ unsigned long f;
39+} memdesc_flags_t;
40+
3741 /*
3842 * Each physical page in the system has a struct page associated with
3943 * it to keep track of whatever it is we are using the page for at the
@@ -72,7 +76,7 @@ struct mem_cgroup; · 32 unmodified lines
7276 #endif
7377
7478 struct page {
75− unsigned long flags; /* Atomic flags, some possibly
79+ memdesc_flags_t flags; /* Atomic flags, some possibly
7680 * updated asynchronously */
7781 /*
7882 * Five words (20/40 bytes) are available in this union.
@@ -383,7 +387,7 @@ struct folio { · 304 unmodified lines
383387 union {
384388 struct {
385389 /* public: */
386− unsigned long flags;
390+ memdesc_flags_t flags;
387391 union {
388392 struct list_head lru;
389393 /* private: avoid cluttering the output */
include/linux/mmzone.h+1−1
@@ -1186,7 +1186,7 @@ static inline bool zone_is_empty(struct zone *zone) · 1185 unmodified lines
11861186 static inline enum zone_type page_zonenum(const struct page *page)
11871187 {
11881188 ASSERT_EXCLUSIVE_BITS(page->flags, ZONES_MASK << ZONES_PGSHIFT);
1189− return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
1189+ return (page->flags.f >> ZONES_PGSHIFT) & ZONES_MASK;
11901190 }
11911191
11921192 static inline enum zone_type folio_zonenum(const struct folio *folio)
include/linux/page-flags.h+20−20
@@ -217,7 +217,7 @@ static __always_inline const struct page *page_fixed_fake_head(const struct page · 216 unmodified lines
217217 * cold cacheline in some cases.
218218 */
219219 if (IS_ALIGNED((unsigned long)page, PAGE_SIZE) &&
220− test_bit(PG_head, &page->flags)) {
220+ test_bit(PG_head, &page->flags.f)) {
221221 /*
222222 * We can safely access the field of the @page[1] with PG_head
223223 * because the @page is a compound page composed with at least
@@ -325,14 +325,14 @@ static __always_inline int PageTail(const struct page *page) · 101 unmodified lines
325325
326326 static __always_inline int PageCompound(const struct page *page)
327327 {
328− return test_bit(PG_head, &page->flags) ||
328+ return test_bit(PG_head, &page->flags.f) ||
329329 READ_ONCE(page->compound_head) & 1;
330330 }
331331
332332 #define PAGE_POISON_PATTERN -1l
333333 static inline int PagePoisoned(const struct page *page)
334334 {
335− return READ_ONCE(page->flags) == PAGE_POISON_PATTERN;
335+ return READ_ONCE(page->flags.f) == PAGE_POISON_PATTERN;
336336 }
337337
338338 #ifdef CONFIG_DEBUG_VM
@@ -349,8 +349,8 @@ static const unsigned long *const_folio_flags(const struct folio *folio, · 10 unmodified lines
349349 const struct page *page = &folio->page;
350350
351351 VM_BUG_ON_PGFLAGS(page->compound_head & 1, page);
352− VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags), page);
353− return &page[n].flags;
352+ VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags.f), page);
353+ return &page[n].flags.f;
354354 }
355355
356356 static unsigned long *folio_flags(struct folio *folio, unsigned n)
@@ -358,8 +358,8 @@ static unsigned long *folio_flags(struct folio *folio, unsigned n) · 1 unmodified line
358358 struct page *page = &folio->page;
359359
360360 VM_BUG_ON_PGFLAGS(page->compound_head & 1, page);
361− VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags), page);
362− return &page[n].flags;
361+ VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags.f), page);
362+ return &page[n].flags.f;
363363 }
364364
365365 /*
@@ -449,37 +449,37 @@ FOLIO_CLEAR_FLAG(name, page) · 83 unmodified lines
449449 #define TESTPAGEFLAG(uname, lname, policy) \
450450 FOLIO_TEST_FLAG(lname, FOLIO_##policy) \
451451 static __always_inline int Page##uname(const struct page *page) \
452−{ return test_bit(PG_##lname, &policy(page, 0)->flags); }
452+{ return test_bit(PG_##lname, &policy(page, 0)->flags.f); }
453453
454454 #define SETPAGEFLAG(uname, lname, policy) \
455455 FOLIO_SET_FLAG(lname, FOLIO_##policy) \
456456 static __always_inline void SetPage##uname(struct page *page) \
457−{ set_bit(PG_##lname, &policy(page, 1)->flags); }
457+{ set_bit(PG_##lname, &policy(page, 1)->flags.f); }
458458
459459 #define CLEARPAGEFLAG(uname, lname, policy) \
460460 FOLIO_CLEAR_FLAG(lname, FOLIO_##policy) \
461461 static __always_inline void ClearPage##uname(struct page *page) \
462−{ clear_bit(PG_##lname, &policy(page, 1)->flags); }
462+{ clear_bit(PG_##lname, &policy(page, 1)->flags.f); }
463463
464464 #define __SETPAGEFLAG(uname, lname, policy) \
465465 __FOLIO_SET_FLAG(lname, FOLIO_##policy) \
466466 static __always_inline void __SetPage##uname(struct page *page) \
467−{ __set_bit(PG_##lname, &policy(page, 1)->flags); }
467+{ __set_bit(PG_##lname, &policy(page, 1)->flags.f); }
468468
469469 #define __CLEARPAGEFLAG(uname, lname, policy) \
470470 __FOLIO_CLEAR_FLAG(lname, FOLIO_##policy) \
471471 static __always_inline void __ClearPage##uname(struct page *page) \
472−{ __clear_bit(PG_##lname, &policy(page, 1)->flags); }
472+{ __clear_bit(PG_##lname, &policy(page, 1)->flags.f); }
473473
474474 #define TESTSETFLAG(uname, lname, policy) \
475475 FOLIO_TEST_SET_FLAG(lname, FOLIO_##policy) \
476476 static __always_inline int TestSetPage##uname(struct page *page) \
477−{ return test_and_set_bit(PG_##lname, &policy(page, 1)->flags); }
477+{ return test_and_set_bit(PG_##lname, &policy(page, 1)->flags.f); }
478478
479479 #define TESTCLEARFLAG(uname, lname, policy) \
480480 FOLIO_TEST_CLEAR_FLAG(lname, FOLIO_##policy) \
481481 static __always_inline int TestClearPage##uname(struct page *page) \
482−{ return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }
482+{ return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags.f); }
483483
484484 #define PAGEFLAG(uname, lname, policy) \
485485 TESTPAGEFLAG(uname, lname, policy) \
@@ -846,7 +846,7 @@ static __always_inline bool folio_test_head(const struct folio *folio) · 360 unmodified lines
846846 static __always_inline int PageHead(const struct page *page)
847847 {
848848 PF_POISONED_CHECK(page);
849− return test_bit(PG_head, &page->flags) && !page_is_fake_head(page);
849+ return test_bit(PG_head, &page->flags.f) && !page_is_fake_head(page);
850850 }
851851
852852 __SETPAGEFLAG(Head, head, PF_ANY)
@@ -1170,28 +1170,28 @@ static __always_inline int PageAnonExclusive(const struct page *page) · 317 unmodified lines
11701170 */
11711171 if (PageHuge(page))
11721172 page = compound_head(page);
1173− return test_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags);
1173+ return test_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags.f);
11741174 }
11751175
11761176 static __always_inline void SetPageAnonExclusive(struct page *page)
11771177 {
11781178 VM_BUG_ON_PGFLAGS(!PageAnonNotKsm(page), page);
11791179 VM_BUG_ON_PGFLAGS(PageHuge(page) && !PageHead(page), page);
1180− set_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags);
1180+ set_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags.f);
11811181 }
11821182
11831183 static __always_inline void ClearPageAnonExclusive(struct page *page)
11841184 {
11851185 VM_BUG_ON_PGFLAGS(!PageAnonNotKsm(page), page);
11861186 VM_BUG_ON_PGFLAGS(PageHuge(page) && !PageHead(page), page);
1187− clear_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags);
1187+ clear_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags.f);
11881188 }
11891189
11901190 static __always_inline void __ClearPageAnonExclusive(struct page *page)
11911191 {
11921192 VM_BUG_ON_PGFLAGS(!PageAnon(page), page);
11931193 VM_BUG_ON_PGFLAGS(PageHuge(page) && !PageHead(page), page);
1194− __clear_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags);
1194+ __clear_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags.f);
11951195 }
11961196
11971197 #ifdef CONFIG_MMU
@@ -1241,7 +1241,7 @@ static __always_inline void __ClearPageAnonExclusive(struct page *page) · 43 unmodified lines
12411241 */
12421242 static inline int folio_has_private(const struct folio *folio)
12431243 {
1244− return !!(folio->flags & PAGE_FLAGS_PRIVATE);
1244+ return !!(folio->flags.f & PAGE_FLAGS_PRIVATE);
12451245 }
12461246
12471247 #undef PF_ANY
include/linux/pgalloc_tag.h+4−3
@@ -107,7 +107,8 @@ static inline bool get_page_tag_ref(struct page *page, union codetag_ref *ref, · 106 unmodified lines
107107 if (static_key_enabled(&mem_profiling_compressed)) {
108108 pgalloc_tag_idx idx;
109109
110− idx = (page->flags >> alloc_tag_ref_offs) & alloc_tag_ref_mask;
110+ idx = (page->flags.f >> alloc_tag_ref_offs) &
111+ alloc_tag_ref_mask;
111112 idx_to_ref(idx, ref);
112113 handle->page = page;
113114 } else {
@@ -149,11 +150,11 @@ static inline void update_page_tag_ref(union pgtag_ref_handle handle, union code · 35 unmodified lines
149150 idx = (unsigned long)ref_to_idx(ref);
150151 idx = (idx & alloc_tag_ref_mask) << alloc_tag_ref_offs;
151152 do {
152− old_flags = READ_ONCE(page->flags);
153+ old_flags = READ_ONCE(page->flags.f);
153154 flags = old_flags;
154155 flags &= ~(alloc_tag_ref_mask << alloc_tag_ref_offs);
155156 flags |= idx;
156− } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags)));
157+ } while (unlikely(!try_cmpxchg(&page->flags.f, &old_flags, flags)));
157158 } else {
158159 if (WARN_ON(!handle.ref || !ref))
159160 return;
include/trace/events/page_ref.h+2−2
@@ -28,7 +28,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_template, · 27 unmodified lines
2828
2929 TP_fast_assign(
3030 __entry->pfn = page_to_pfn(page);
31− __entry->flags = page->flags;
31+ __entry->flags = page->flags.f;
3232 __entry->count = page_ref_count(page);
3333 __entry->mapcount = atomic_read(&page->_mapcount);
3434 __entry->mapping = page->mapping;
@@ -77,7 +77,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template, · 42 unmodified lines
7777
7878 TP_fast_assign(
7979 __entry->pfn = page_to_pfn(page);
80− __entry->flags = page->flags;
80+ __entry->flags = page->flags.f;
8181 __entry->count = page_ref_count(page);
8282 __entry->mapcount = atomic_read(&page->_mapcount);
8383 __entry->mapping = page->mapping;
mm/filemap.c+4−4
@@ -1140,10 +1140,10 @@ static int wake_page_function(wait_queue_entry_t *wait, unsigned mode, int sync, · 1139 unmodified lines
11401140 */
11411141 flags = wait->flags;
11421142 if (flags & WQ_FLAG_EXCLUSIVE) {
1143− if (test_bit(key->bit_nr, &key->folio->flags))
1143+ if (test_bit(key->bit_nr, &key->folio->flags.f))
11441144 return -1;
11451145 if (flags & WQ_FLAG_CUSTOM) {
1146− if (test_and_set_bit(key->bit_nr, &key->folio->flags))
1146+ if (test_and_set_bit(key->bit_nr, &key->folio->flags.f))
11471147 return -1;
11481148 flags |= WQ_FLAG_DONE;
11491149 }
@@ -1226,9 +1226,9 @@ static inline bool folio_trylock_flag(struct folio *folio, int bit_nr, · 76 unmodified lines
12261226 struct wait_queue_entry *wait)
12271227 {
12281228 if (wait->flags & WQ_FLAG_EXCLUSIVE) {
1229− if (test_and_set_bit(bit_nr, &folio->flags))
1229+ if (test_and_set_bit(bit_nr, &folio->flags.f))
12301230 return false;
1231− } else if (test_bit(bit_nr, &folio->flags))
1231+ } else if (test_bit(bit_nr, &folio->flags.f))
12321232 return false;
12331233
12341234 wait->flags |= WQ_FLAG_WOKEN | WQ_FLAG_DONE;
mm/huge_memory.c+2−2
@@ -3303,8 +3303,8 @@ static void __split_folio_to_order(struct folio *folio, int old_order, · 3302 unmodified lines
33033303 * unreferenced sub-pages of an anonymous THP: we can simply drop
33043304 * PG_anon_exclusive (-> PG_mappedtodisk) for these here.
33053305 */
3306− new_folio->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;
3307− new_folio->flags |= (folio->flags &
3306+ new_folio->flags.f &= ~PAGE_FLAGS_CHECK_AT_PREP;
3307+ new_folio->flags.f |= (folio->flags.f &
33083308 ((1L << PG_referenced) |
33093309 (1L << PG_swapbacked) |
33103310 (1L << PG_swapcache) |
mm/memory-failure.c+6−6
@@ -1707,10 +1707,10 @@ static int identify_page_state(unsigned long pfn, struct page *p, · 1706 unmodified lines
17071707 * carried out only if the first check can't determine the page status.
17081708 */
17091709 for (ps = error_states;; ps++)
1710− if ((p->flags & ps->mask) == ps->res)
1710+ if ((p->flags.f & ps->mask) == ps->res)
17111711 break;
17121712
1713− page_flags |= (p->flags & (1UL << PG_dirty));
1713+ page_flags |= (p->flags.f & (1UL << PG_dirty));
17141714
17151715 if (!ps->mask)
17161716 for (ps = error_states;; ps++)
@@ -2137,7 +2137,7 @@ retry: · 420 unmodified lines
21372137 return action_result(pfn, MF_MSG_FREE_HUGE, res);
21382138 }
21392139
2140− page_flags = folio->flags;
2140+ page_flags = folio->flags.f;
21412141
21422142 if (!hwpoison_user_mappings(folio, p, pfn, flags)) {
21432143 folio_unlock(folio);
@@ -2398,7 +2398,7 @@ try_again: · 254 unmodified lines
23982398 * folio_remove_rmap_*() in try_to_unmap_one(). So to determine page
23992399 * status correctly, we save a copy of the page flags at this time.
24002400 */
2401− page_flags = folio->flags;
2401+ page_flags = folio->flags.f;
24022402
24032403 /*
24042404 * __munlock_folio() may clear a writeback folio's LRU flag without
@@ -2744,13 +2744,13 @@ static int soft_offline_in_use_page(struct page *page) · 339 unmodified lines
27442744 putback_movable_pages(&pagelist);
27452745
27462746 pr_info("%#lx: %s migration failed %ld, type %pGp\n",
2747− pfn, msg_page[huge], ret, &page->flags);
2747+ pfn, msg_page[huge], ret, &page->flags.f);
27482748 if (ret > 0)
27492749 ret = -EBUSY;
27502750 }
27512751 } else {
27522752 pr_info("%#lx: %s isolation failed, page count %d, type %pGp\n",
2753− pfn, msg_page[huge], page_count(page), &page->flags);
2753+ pfn, msg_page[huge], page_count(page), &page->flags.f);
27542754 ret = -EBUSY;
27552755 }
27562756 return ret;
mm/mmzone.c+2−2
@@ -99,14 +99,14 @@ int folio_xchg_last_cpupid(struct folio *folio, int cpupid) · 98 unmodified lines
9999 unsigned long old_flags, flags;
100100 int last_cpupid;
101101
102− old_flags = READ_ONCE(folio->flags);
102+ old_flags = READ_ONCE(folio->flags.f);
103103 do {
104104 flags = old_flags;
105105 last_cpupid = (flags >> LAST_CPUPID_PGSHIFT) & LAST_CPUPID_MASK;
106106
107107 flags &= ~(LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT);
108108 flags |= (cpupid & LAST_CPUPID_MASK) << LAST_CPUPID_PGSHIFT;
109− } while (unlikely(!try_cmpxchg(&folio->flags, &old_flags, flags)));
109+ } while (unlikely(!try_cmpxchg(&folio->flags.f, &old_flags, flags)));
110110
111111 return last_cpupid;
112112 }
mm/page_alloc.c+6−6
@@ -950,7 +950,7 @@ static inline void __free_one_page(struct page *page, · 949 unmodified lines
950950 bool to_tail;
951951
952952 VM_BUG_ON(!zone_is_initialized(zone));
953− VM_BUG_ON_PAGE(page->flags & PAGE_FLAGS_CHECK_AT_PREP, page);
953+ VM_BUG_ON_PAGE(page->flags.f & PAGE_FLAGS_CHECK_AT_PREP, page);
954954
955955 VM_BUG_ON(migratetype == -1);
956956 VM_BUG_ON_PAGE(pfn & ((1 << order) - 1), page);
@@ -1043,7 +1043,7 @@ static inline bool page_expected_state(struct page *page, · 86 unmodified lines
10431043 page->memcg_data |
10441044 #endif
10451045 page_pool_page_is_pp(page) |
1046− (page->flags & check_flags)))
1046+ (page->flags.f & check_flags)))
10471047 return false;
10481048
10491049 return true;
@@ -1059,7 +1059,7 @@ static const char *page_bad_reason(struct page *page, unsigned long flags) · 9 unmodified lines
10591059 bad_reason = "non-NULL mapping";
10601060 if (unlikely(page_ref_count(page) != 0))
10611061 bad_reason = "nonzero _refcount";
1062− if (unlikely(page->flags & flags)) {
1062+ if (unlikely(page->flags.f & flags)) {
10631063 if (flags == PAGE_FLAGS_CHECK_AT_PREP)
10641064 bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag(s) set";
10651065 else
@@ -1358,7 +1358,7 @@ __always_inline bool free_pages_prepare(struct page *page, · 292 unmodified lines
13581358 int i;
13591359
13601360 if (compound) {
1361− page[1].flags &= ~PAGE_FLAGS_SECOND;
1361+ page[1].flags.f &= ~PAGE_FLAGS_SECOND;
13621362 #ifdef NR_PAGES_IN_LARGE_FOLIO
13631363 folio->_nr_pages = 0;
13641364 #endif
@@ -1372,7 +1372,7 @@ __always_inline bool free_pages_prepare(struct page *page, · 7 unmodified lines
13721372 continue;
13731373 }
13741374 }
1375− (page + i)->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;
1375+ (page + i)->flags.f &= ~PAGE_FLAGS_CHECK_AT_PREP;
13761376 }
13771377 }
13781378 if (folio_test_anon(folio)) {
@@ -1391,7 +1391,7 @@ __always_inline bool free_pages_prepare(struct page *page, · 12 unmodified lines
13911391 }
13921392
13931393 page_cpupid_reset_last(page);
1394− page->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;
1394+ page->flags.f &= ~PAGE_FLAGS_CHECK_AT_PREP;
13951395 reset_page_owner(page, order);
13961396 page_table_check_free(page, order);
13971397 pgalloc_tag_sub(page, 1 << order);
mm/swap.c+4−4
@@ -387,14 +387,14 @@ static void __lru_cache_activate_folio(struct folio *folio) · 386 unmodified lines
387387
388388 static void lru_gen_inc_refs(struct folio *folio)
389389 {
390− unsigned long new_flags, old_flags = READ_ONCE(folio->flags);
390+ unsigned long new_flags, old_flags = READ_ONCE(folio->flags.f);
391391
392392 if (folio_test_unevictable(folio))
393393 return;
394394
395395 /* see the comment on LRU_REFS_FLAGS */
396396 if (!folio_test_referenced(folio)) {
397− set_mask_bits(&folio->flags, LRU_REFS_MASK, BIT(PG_referenced));
397+ set_mask_bits(&folio->flags.f, LRU_REFS_MASK, BIT(PG_referenced));
398398 return;
399399 }
400400
@@ -406,7 +406,7 @@ static void lru_gen_inc_refs(struct folio *folio) · 5 unmodified lines
406406 }
407407
408408 new_flags = old_flags + BIT(LRU_REFS_PGOFF);
409− } while (!try_cmpxchg(&folio->flags, &old_flags, new_flags));
409+ } while (!try_cmpxchg(&folio->flags.f, &old_flags, new_flags));
410410 }
411411
412412 static bool lru_gen_clear_refs(struct folio *folio)
@@ -418,7 +418,7 @@ static bool lru_gen_clear_refs(struct folio *folio) · 5 unmodified lines
418418 if (gen < 0)
419419 return true;
420420
421− set_mask_bits(&folio->flags, LRU_REFS_FLAGS | BIT(PG_workingset), 0);
421+ set_mask_bits(&folio->flags.f, LRU_REFS_FLAGS | BIT(PG_workingset), 0);
422422
423423 lrugen = &folio_lruvec(folio)->lrugen;
424424 /* whether can do without shuffling under the LRU lock */
mm/vmscan.c+9−9
@@ -888,11 +888,11 @@ static bool lru_gen_set_refs(struct folio *folio) · 887 unmodified lines
888888 {
889889 /* see the comment on LRU_REFS_FLAGS */
890890 if (!folio_test_referenced(folio) && !folio_test_workingset(folio)) {
891− set_mask_bits(&folio->flags, LRU_REFS_MASK, BIT(PG_referenced));
891+ set_mask_bits(&folio->flags.f, LRU_REFS_MASK, BIT(PG_referenced));
892892 return false;
893893 }
894894
895− set_mask_bits(&folio->flags, LRU_REFS_FLAGS, BIT(PG_workingset));
895+ set_mask_bits(&folio->flags.f, LRU_REFS_FLAGS, BIT(PG_workingset));
896896 return true;
897897 }
898898 #else
@@ -3257,13 +3257,13 @@ static bool positive_ctrl_err(struct ctrl_pos *sp, struct ctrl_pos *pv) · 2358 unmodified lines
32573257 /* promote pages accessed through page tables */
32583258 static int folio_update_gen(struct folio *folio, int gen)
32593259 {
3260− unsigned long new_flags, old_flags = READ_ONCE(folio->flags);
3260+ unsigned long new_flags, old_flags = READ_ONCE(folio->flags.f);
32613261
32623262 VM_WARN_ON_ONCE(gen >= MAX_NR_GENS);
32633263
32643264 /* see the comment on LRU_REFS_FLAGS */
32653265 if (!folio_test_referenced(folio) && !folio_test_workingset(folio)) {
3266− set_mask_bits(&folio->flags, LRU_REFS_MASK, BIT(PG_referenced));
3266+ set_mask_bits(&folio->flags.f, LRU_REFS_MASK, BIT(PG_referenced));
32673267 return -1;
32683268 }
32693269
@@ -3274,7 +3274,7 @@ static int folio_update_gen(struct folio *folio, int gen) · 4 unmodified lines
32743274
32753275 new_flags = old_flags & ~(LRU_GEN_MASK | LRU_REFS_FLAGS);
32763276 new_flags |= ((gen + 1UL) << LRU_GEN_PGOFF) | BIT(PG_workingset);
3277− } while (!try_cmpxchg(&folio->flags, &old_flags, new_flags));
3277+ } while (!try_cmpxchg(&folio->flags.f, &old_flags, new_flags));
32783278
32793279 return ((old_flags & LRU_GEN_MASK) >> LRU_GEN_PGOFF) - 1;
32803280 }
@@ -3285,7 +3285,7 @@ static int folio_inc_gen(struct lruvec *lruvec, struct folio *folio, bool reclai · 4 unmodified lines
32853285 int type = folio_is_file_lru(folio);
32863286 struct lru_gen_folio *lrugen = &lruvec->lrugen;
32873287 int new_gen, old_gen = lru_gen_from_seq(lrugen->min_seq[type]);
3288− unsigned long new_flags, old_flags = READ_ONCE(folio->flags);
3288+ unsigned long new_flags, old_flags = READ_ONCE(folio->flags.f);
32893289
32903290 VM_WARN_ON_ONCE_FOLIO(!(old_flags & LRU_GEN_MASK), folio);
32913291
@@ -3302,7 +3302,7 @@ static int folio_inc_gen(struct lruvec *lruvec, struct folio *folio, bool reclai · 10 unmodified lines
33023302 /* for folio_end_writeback() */
33033303 if (reclaiming)
33043304 new_flags |= BIT(PG_reclaim);
3305− } while (!try_cmpxchg(&folio->flags, &old_flags, new_flags));
3305+ } while (!try_cmpxchg(&folio->flags.f, &old_flags, new_flags));
33063306
33073307 lru_gen_update_size(lruvec, folio, old_gen, new_gen);
33083308
@@ -4553,7 +4553,7 @@ static bool isolate_folio(struct lruvec *lruvec, struct folio *folio, struct sca · 1244 unmodified lines
45534553
45544554 /* see the comment on LRU_REFS_FLAGS */
45554555 if (!folio_test_referenced(folio))
4556− set_mask_bits(&folio->flags, LRU_REFS_MASK, 0);
4556+ set_mask_bits(&folio->flags.f, LRU_REFS_MASK, 0);
45574557
45584558 /* for shrink_folio_list() */
45594559 folio_clear_reclaim(folio);
@@ -4766,7 +4766,7 @@ retry: · 206 unmodified lines
47664766
47674767 /* don't add rejected folios to the oldest generation */
47684768 if (lru_gen_folio_seq(lruvec, folio, false) == min_seq[type])
4769− set_mask_bits(&folio->flags, LRU_REFS_FLAGS, BIT(PG_active));
4769+ set_mask_bits(&folio->flags.f, LRU_REFS_FLAGS, BIT(PG_active));
47704770 }
47714771
47724772 spin_lock_irq(&lruvec->lru_lock);
mm/workingset.c+1−1
@@ -318,7 +318,7 @@ static void lru_gen_refault(struct folio *folio, void *shadow) · 317 unmodified lines
318318 folio_set_workingset(folio);
319319 mod_lruvec_state(lruvec, WORKINGSET_RESTORE_BASE + type, delta);
320320 } else
321− set_mask_bits(&folio->flags, LRU_REFS_MASK, (refs - 1UL) << LRU_REFS_PGOFF);
321+ set_mask_bits(&folio->flags.f, LRU_REFS_MASK, (refs - 1UL) << LRU_REFS_PGOFF);
322322 unlock:
323323 rcu_read_unlock();
324324 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t