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

mm: Add PG_arch_2 page flag

For arm64 MTE support it is necessary to be able to mark pages that
contain user space visible tags that will need to be saved/restored e.g.
when swapped out.

To support this add a new arch specific flag (PG_arch_2). This flag is
only available on 64-bit architectures due to the limited number of
spare page flags on the 32-bit ones.

Signed-off-by: Steven Price <steven.price@arm.com>
[catalin.marinas@arm.com: use CONFIG_64BIT for guarding this new flag]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>

authored by

Steven Price and committed by
Catalin Marinas
4beba948 637ec831

+17 -1
+3
fs/proc/page.c
··· 217 217 u |= kpf_copy_bit(k, KPF_PRIVATE_2, PG_private_2); 218 218 u |= kpf_copy_bit(k, KPF_OWNER_PRIVATE, PG_owner_priv_1); 219 219 u |= kpf_copy_bit(k, KPF_ARCH, PG_arch_1); 220 + #ifdef CONFIG_64BIT 221 + u |= kpf_copy_bit(k, KPF_ARCH_2, PG_arch_2); 222 + #endif 220 223 221 224 return u; 222 225 };
+1
include/linux/kernel-page-flags.h
··· 17 17 #define KPF_ARCH 38 18 18 #define KPF_UNCACHED 39 19 19 #define KPF_SOFTDIRTY 40 20 + #define KPF_ARCH_2 41 20 21 21 22 #endif /* LINUX_KERNEL_PAGE_FLAGS_H */
+3
include/linux/page-flags.h
··· 136 136 PG_young, 137 137 PG_idle, 138 138 #endif 139 + #ifdef CONFIG_64BIT 140 + PG_arch_2, 141 + #endif 139 142 __NR_PAGEFLAGS, 140 143 141 144 /* Filesystems */
+8 -1
include/trace/events/mmflags.h
··· 79 79 #define IF_HAVE_PG_IDLE(flag,string) 80 80 #endif 81 81 82 + #ifdef CONFIG_64BIT 83 + #define IF_HAVE_PG_ARCH_2(flag,string) ,{1UL << flag, string} 84 + #else 85 + #define IF_HAVE_PG_ARCH_2(flag,string) 86 + #endif 87 + 82 88 #define __def_pageflag_names \ 83 89 {1UL << PG_locked, "locked" }, \ 84 90 {1UL << PG_waiters, "waiters" }, \ ··· 111 105 IF_HAVE_PG_UNCACHED(PG_uncached, "uncached" ) \ 112 106 IF_HAVE_PG_HWPOISON(PG_hwpoison, "hwpoison" ) \ 113 107 IF_HAVE_PG_IDLE(PG_young, "young" ) \ 114 - IF_HAVE_PG_IDLE(PG_idle, "idle" ) 108 + IF_HAVE_PG_IDLE(PG_idle, "idle" ) \ 109 + IF_HAVE_PG_ARCH_2(PG_arch_2, "arch_2" ) 115 110 116 111 #define show_page_flags(flags) \ 117 112 (flags) ? __print_flags(flags, "|", \
+2
tools/vm/page-types.c
··· 78 78 #define KPF_ARCH 38 79 79 #define KPF_UNCACHED 39 80 80 #define KPF_SOFTDIRTY 40 81 + #define KPF_ARCH_2 41 81 82 82 83 /* [48-] take some arbitrary free slots for expanding overloaded flags 83 84 * not part of kernel API ··· 136 135 [KPF_ARCH] = "h:arch", 137 136 [KPF_UNCACHED] = "c:uncached", 138 137 [KPF_SOFTDIRTY] = "f:softdirty", 138 + [KPF_ARCH_2] = "H:arch_2", 139 139 140 140 [KPF_READAHEAD] = "I:readahead", 141 141 [KPF_SLOB_FREE] = "P:slob_free",