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 PG_mappedtodisk to PG_owner_2

This flag has similar constraints to PG_owner_priv_1 -- it is ignored by
core code, and is entirely for the use of the code which allocated the
folio. Since the pagecache does not use it, individual filesystems can
use it. The bufferhead code does use it, so filesystems which use the
buffer cache must not use it for another purpose.

Link: https://lkml.kernel.org/r/20240821193445.2294269-10-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
02e1960a 6dc15138

+24 -16
+1 -1
fs/proc/page.c
··· 211 211 #endif 212 212 213 213 u |= kpf_copy_bit(k, KPF_RESERVED, PG_reserved); 214 - u |= kpf_copy_bit(k, KPF_MAPPEDTODISK, PG_mappedtodisk); 214 + u |= kpf_copy_bit(k, KPF_OWNER_2, PG_owner_2); 215 215 u |= kpf_copy_bit(k, KPF_PRIVATE, PG_private); 216 216 u |= kpf_copy_bit(k, KPF_PRIVATE_2, PG_private_2); 217 217 u |= kpf_copy_bit(k, KPF_OWNER_PRIVATE, PG_owner_priv_1);
+1 -1
include/linux/kernel-page-flags.h
··· 10 10 */ 11 11 #define KPF_RESERVED 32 12 12 #define KPF_MLOCKED 33 13 - #define KPF_MAPPEDTODISK 34 13 + #define KPF_OWNER_2 34 14 14 #define KPF_PRIVATE 35 15 15 #define KPF_PRIVATE_2 36 16 16 #define KPF_OWNER_PRIVATE 37
+16 -8
include/linux/page-flags.h
··· 101 101 PG_waiters, /* Page has waiters, check its waitqueue. Must be bit #7 and in the same byte as "PG_locked" */ 102 102 PG_active, 103 103 PG_workingset, 104 - PG_owner_priv_1, /* Owner use. If pagecache, fs may use*/ 104 + PG_owner_priv_1, /* Owner use. If pagecache, fs may use */ 105 + PG_owner_2, /* Owner use. If pagecache, fs may use */ 105 106 PG_arch_1, 106 107 PG_reserved, 107 108 PG_private, /* If pagecache, has fs-private data */ 108 109 PG_private_2, /* If pagecache, has fs aux data */ 109 - PG_mappedtodisk, /* Has blocks allocated on-disk */ 110 110 PG_reclaim, /* To be reclaimed asap */ 111 111 PG_swapbacked, /* Page is backed by RAM/swap */ 112 112 PG_unevictable, /* Page is "unevictable" */ ··· 131 131 132 132 PG_readahead = PG_reclaim, 133 133 134 + /* Anonymous memory (and shmem) */ 135 + PG_swapcache = PG_owner_priv_1, /* Swap page: swp_entry_t in private */ 136 + /* Some filesystems */ 137 + PG_checked = PG_owner_priv_1, 138 + 134 139 /* 135 140 * Depending on the way an anonymous folio can be mapped into a page 136 141 * table (e.g., single PMD/PUD/CONT of the head page vs. PTE-mapped ··· 143 138 * tail pages of an anonymous folio. For now, we only expect it to be 144 139 * set on tail pages for PTE-mapped THP. 145 140 */ 146 - PG_anon_exclusive = PG_mappedtodisk, 141 + PG_anon_exclusive = PG_owner_2, 147 142 148 - /* Filesystems */ 149 - PG_checked = PG_owner_priv_1, 150 - 151 - /* SwapBacked */ 152 - PG_swapcache = PG_owner_priv_1, /* Swap page: swp_entry_t in private */ 143 + /* 144 + * Set if all buffer heads in the folio are mapped. 145 + * Filesystems which do not use BHs can use it for their own purpose. 146 + */ 147 + PG_mappedtodisk = PG_owner_2, 153 148 154 149 /* Two page bits are conscripted by FS-Cache to maintain local caching 155 150 * state. These bits are set on pages belonging to the netfs's inodes ··· 544 539 */ 545 540 PAGEFLAG(Private, private, PF_ANY) 546 541 PAGEFLAG(Private2, private_2, PF_ANY) TESTSCFLAG(Private2, private_2, PF_ANY) 542 + 543 + /* owner_2 can be set on tail pages for anon memory */ 544 + FOLIO_FLAG(owner_2, FOLIO_HEAD_PAGE) 547 545 548 546 /* 549 547 * Only test-and-set exist for PG_writeback. The unconditional operators are
+1 -1
include/trace/events/mmflags.h
··· 107 107 DEF_PAGEFLAG_NAME(active), \ 108 108 DEF_PAGEFLAG_NAME(workingset), \ 109 109 DEF_PAGEFLAG_NAME(owner_priv_1), \ 110 + DEF_PAGEFLAG_NAME(owner_2), \ 110 111 DEF_PAGEFLAG_NAME(arch_1), \ 111 112 DEF_PAGEFLAG_NAME(reserved), \ 112 113 DEF_PAGEFLAG_NAME(private), \ 113 114 DEF_PAGEFLAG_NAME(private_2), \ 114 115 DEF_PAGEFLAG_NAME(writeback), \ 115 116 DEF_PAGEFLAG_NAME(head), \ 116 - DEF_PAGEFLAG_NAME(mappedtodisk), \ 117 117 DEF_PAGEFLAG_NAME(reclaim), \ 118 118 DEF_PAGEFLAG_NAME(swapbacked), \ 119 119 DEF_PAGEFLAG_NAME(unevictable) \
+5 -5
tools/mm/page-types.c
··· 71 71 /* [32-] kernel hacking assistances */ 72 72 #define KPF_RESERVED 32 73 73 #define KPF_MLOCKED 33 74 - #define KPF_MAPPEDTODISK 34 74 + #define KPF_OWNER_2 34 75 75 #define KPF_PRIVATE 35 76 76 #define KPF_PRIVATE_2 36 77 77 #define KPF_OWNER_PRIVATE 37 ··· 129 129 130 130 [KPF_RESERVED] = "r:reserved", 131 131 [KPF_MLOCKED] = "m:mlocked", 132 - [KPF_MAPPEDTODISK] = "d:mappedtodisk", 132 + [KPF_OWNER_2] = "d:owner_2", 133 133 [KPF_PRIVATE] = "P:private", 134 134 [KPF_PRIVATE_2] = "p:private_2", 135 135 [KPF_OWNER_PRIVATE] = "O:owner_private", ··· 472 472 473 473 static uint64_t expand_overloaded_flags(uint64_t flags, uint64_t pme) 474 474 { 475 - /* Anonymous pages overload PG_mappedtodisk */ 476 - if ((flags & BIT(ANON)) && (flags & BIT(MAPPEDTODISK))) 477 - flags ^= BIT(MAPPEDTODISK) | BIT(ANON_EXCLUSIVE); 475 + /* Anonymous pages use PG_owner_2 for anon_exclusive */ 476 + if ((flags & BIT(ANON)) && (flags & BIT(OWNER_2))) 477 + flags ^= BIT(OWNER_2) | BIT(ANON_EXCLUSIVE); 478 478 479 479 /* SLUB overloads several page flags */ 480 480 if (flags & BIT(SLAB)) {