Skip to content

Commit 7a87225

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
x86: remove PG_uncached
Convert x86 to use PG_arch_2 instead of PG_uncached and remove PG_uncached. Link: https://lkml.kernel.org/r/20240821193445.2294269-11-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 02e1960 commit 7a87225

File tree

11 files changed

+31
-76
lines changed

11 files changed

+31
-76
lines changed

Documentation/features/vm/PG_uncached/arch-support.txt

Lines changed: 0 additions & 30 deletions
This file was deleted.

arch/arm64/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2100,7 +2100,8 @@ config ARM64_MTE
21002100
depends on ARM64_PAN
21012101
select ARCH_HAS_SUBPAGE_FAULTS
21022102
select ARCH_USES_HIGH_VMA_FLAGS
2103-
select ARCH_USES_PG_ARCH_X
2103+
select ARCH_USES_PG_ARCH_2
2104+
select ARCH_USES_PG_ARCH_3
21042105
help
21052106
Memory Tagging (part of the ARMv8.5 Extensions) provides
21062107
architectural support for run-time, always-on detection of

arch/x86/Kconfig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,6 +1799,7 @@ config X86_PAT
17991799
def_bool y
18001800
prompt "x86 PAT support" if EXPERT
18011801
depends on MTRR
1802+
select ARCH_USES_PG_ARCH_2
18021803
help
18031804
Use PAT attributes to setup page level cache control.
18041805

@@ -1810,10 +1811,6 @@ config X86_PAT
18101811

18111812
If unsure, say Y.
18121813

1813-
config ARCH_USES_PG_UNCACHED
1814-
def_bool y
1815-
depends on X86_PAT
1816-
18171814
config X86_UMIP
18181815
def_bool y
18191816
prompt "User Mode Instruction Prevention" if EXPERT

arch/x86/mm/pat/memtype.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ __setup("debugpat", pat_debug_setup);
104104

105105
#ifdef CONFIG_X86_PAT
106106
/*
107-
* X86 PAT uses page flags arch_1 and uncached together to keep track of
107+
* X86 PAT uses page flags arch_1 and arch_2 together to keep track of
108108
* memory type of pages that have backing page struct.
109109
*
110110
* X86 PAT supports 4 different memory types:
@@ -118,9 +118,9 @@ __setup("debugpat", pat_debug_setup);
118118

119119
#define _PGMT_WB 0
120120
#define _PGMT_WC (1UL << PG_arch_1)
121-
#define _PGMT_UC_MINUS (1UL << PG_uncached)
122-
#define _PGMT_WT (1UL << PG_uncached | 1UL << PG_arch_1)
123-
#define _PGMT_MASK (1UL << PG_uncached | 1UL << PG_arch_1)
121+
#define _PGMT_UC_MINUS (1UL << PG_arch_2)
122+
#define _PGMT_WT (1UL << PG_arch_2 | 1UL << PG_arch_1)
123+
#define _PGMT_MASK (1UL << PG_arch_2 | 1UL << PG_arch_1)
124124
#define _PGMT_CLEAR_MASK (~_PGMT_MASK)
125125

126126
static inline enum page_cache_mode get_page_memtype(struct page *pg)

fs/proc/page.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,18 +206,16 @@ u64 stable_page_flags(const struct page *page)
206206
u |= kpf_copy_bit(page->flags, KPF_HWPOISON, PG_hwpoison);
207207
#endif
208208

209-
#ifdef CONFIG_ARCH_USES_PG_UNCACHED
210-
u |= kpf_copy_bit(k, KPF_UNCACHED, PG_uncached);
211-
#endif
212-
213209
u |= kpf_copy_bit(k, KPF_RESERVED, PG_reserved);
214210
u |= kpf_copy_bit(k, KPF_OWNER_2, PG_owner_2);
215211
u |= kpf_copy_bit(k, KPF_PRIVATE, PG_private);
216212
u |= kpf_copy_bit(k, KPF_PRIVATE_2, PG_private_2);
217213
u |= kpf_copy_bit(k, KPF_OWNER_PRIVATE, PG_owner_priv_1);
218214
u |= kpf_copy_bit(k, KPF_ARCH, PG_arch_1);
219-
#ifdef CONFIG_ARCH_USES_PG_ARCH_X
215+
#ifdef CONFIG_ARCH_USES_PG_ARCH_2
220216
u |= kpf_copy_bit(k, KPF_ARCH_2, PG_arch_2);
217+
#endif
218+
#ifdef CONFIG_ARCH_USES_PG_ARCH_3
221219
u |= kpf_copy_bit(k, KPF_ARCH_3, PG_arch_3);
222220
#endif
223221

include/linux/kernel-page-flags.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#define KPF_PRIVATE_2 36
1616
#define KPF_OWNER_PRIVATE 37
1717
#define KPF_ARCH 38
18-
#define KPF_UNCACHED 39
1918
#define KPF_SOFTDIRTY 40
2019
#define KPF_ARCH_2 41
2120
#define KPF_ARCH_3 42

include/linux/page-flags.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,17 @@ enum pageflags {
113113
#ifdef CONFIG_MMU
114114
PG_mlocked, /* Page is vma mlocked */
115115
#endif
116-
#ifdef CONFIG_ARCH_USES_PG_UNCACHED
117-
PG_uncached, /* Page has been mapped as uncached */
118-
#endif
119116
#ifdef CONFIG_MEMORY_FAILURE
120117
PG_hwpoison, /* hardware poisoned page. Don't touch */
121118
#endif
122119
#if defined(CONFIG_PAGE_IDLE_FLAG) && defined(CONFIG_64BIT)
123120
PG_young,
124121
PG_idle,
125122
#endif
126-
#ifdef CONFIG_ARCH_USES_PG_ARCH_X
123+
#ifdef CONFIG_ARCH_USES_PG_ARCH_2
127124
PG_arch_2,
125+
#endif
126+
#ifdef CONFIG_ARCH_USES_PG_ARCH_3
128127
PG_arch_3,
129128
#endif
130129
__NR_PAGEFLAGS,
@@ -602,12 +601,6 @@ FOLIO_FLAG_FALSE(mlocked)
602601
FOLIO_TEST_SET_FLAG_FALSE(mlocked)
603602
#endif
604603

605-
#ifdef CONFIG_ARCH_USES_PG_UNCACHED
606-
PAGEFLAG(Uncached, uncached, PF_NO_COMPOUND)
607-
#else
608-
PAGEFLAG_FALSE(Uncached, uncached)
609-
#endif
610-
611604
#ifdef CONFIG_MEMORY_FAILURE
612605
PAGEFLAG(HWPoison, hwpoison, PF_ANY)
613606
TESTSCFLAG(HWPoison, hwpoison, PF_ANY)

include/trace/events/mmflags.h

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@
7171
#define IF_HAVE_PG_MLOCK(_name)
7272
#endif
7373

74-
#ifdef CONFIG_ARCH_USES_PG_UNCACHED
75-
#define IF_HAVE_PG_UNCACHED(_name) ,{1UL << PG_##_name, __stringify(_name)}
76-
#else
77-
#define IF_HAVE_PG_UNCACHED(_name)
78-
#endif
79-
8074
#ifdef CONFIG_MEMORY_FAILURE
8175
#define IF_HAVE_PG_HWPOISON(_name) ,{1UL << PG_##_name, __stringify(_name)}
8276
#else
@@ -89,10 +83,16 @@
8983
#define IF_HAVE_PG_IDLE(_name)
9084
#endif
9185

92-
#ifdef CONFIG_ARCH_USES_PG_ARCH_X
93-
#define IF_HAVE_PG_ARCH_X(_name) ,{1UL << PG_##_name, __stringify(_name)}
86+
#ifdef CONFIG_ARCH_USES_PG_ARCH_2
87+
#define IF_HAVE_PG_ARCH_2(_name) ,{1UL << PG_##_name, __stringify(_name)}
88+
#else
89+
#define IF_HAVE_PG_ARCH_2(_name)
90+
#endif
91+
92+
#ifdef CONFIG_ARCH_USES_PG_ARCH_3
93+
#define IF_HAVE_PG_ARCH_3(_name) ,{1UL << PG_##_name, __stringify(_name)}
9494
#else
95-
#define IF_HAVE_PG_ARCH_X(_name)
95+
#define IF_HAVE_PG_ARCH_3(_name)
9696
#endif
9797

9898
#define DEF_PAGEFLAG_NAME(_name) { 1UL << PG_##_name, __stringify(_name) }
@@ -118,12 +118,11 @@
118118
DEF_PAGEFLAG_NAME(swapbacked), \
119119
DEF_PAGEFLAG_NAME(unevictable) \
120120
IF_HAVE_PG_MLOCK(mlocked) \
121-
IF_HAVE_PG_UNCACHED(uncached) \
122121
IF_HAVE_PG_HWPOISON(hwpoison) \
123122
IF_HAVE_PG_IDLE(idle) \
124123
IF_HAVE_PG_IDLE(young) \
125-
IF_HAVE_PG_ARCH_X(arch_2) \
126-
IF_HAVE_PG_ARCH_X(arch_3)
124+
IF_HAVE_PG_ARCH_2(arch_2) \
125+
IF_HAVE_PG_ARCH_3(arch_3)
127126

128127
#define show_page_flags(flags) \
129128
(flags) ? __print_flags(flags, "|", \

mm/Kconfig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,13 +1079,10 @@ config ARCH_USES_HIGH_VMA_FLAGS
10791079
config ARCH_HAS_PKEYS
10801080
bool
10811081

1082-
config ARCH_USES_PG_ARCH_X
1082+
config ARCH_USES_PG_ARCH_2
1083+
bool
1084+
config ARCH_USES_PG_ARCH_3
10831085
bool
1084-
help
1085-
Enable the definition of PG_arch_x page flags with x > 1. Only
1086-
suitable for 64-bit architectures with CONFIG_FLATMEM or
1087-
CONFIG_SPARSEMEM_VMEMMAP enabled, otherwise there may not be
1088-
enough room for additional bits in page->flags.
10891086

10901087
config VM_EVENT_COUNTERS
10911088
default y

mm/huge_memory.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2993,8 +2993,10 @@ static void __split_huge_page_tail(struct folio *folio, int tail,
29932993
(1L << PG_workingset) |
29942994
(1L << PG_locked) |
29952995
(1L << PG_unevictable) |
2996-
#ifdef CONFIG_ARCH_USES_PG_ARCH_X
2996+
#ifdef CONFIG_ARCH_USES_PG_ARCH_2
29972997
(1L << PG_arch_2) |
2998+
#endif
2999+
#ifdef CONFIG_ARCH_USES_PG_ARCH_3
29983000
(1L << PG_arch_3) |
29993001
#endif
30003002
(1L << PG_dirty) |

0 commit comments

Comments
 (0)