]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - include/trace/events/mmflags.h
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[mirror_ubuntu-jammy-kernel.git] / include / trace / events / mmflags.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
aff28015
MH
2#include <linux/node.h>
3#include <linux/mmzone.h>
4#include <linux/compaction.h>
420adbe9
VB
5/*
6 * The order of these masks is important. Matching masks will be seen
7 * first and the left over flags will end up showing by themselves.
8 *
9 * For example, if we have GFP_KERNEL before GFP_USER we wil get:
10 *
11 * GFP_KERNEL|GFP_HARDWALL
12 *
13 * Thus most bits set go first.
14 */
15
16#define __def_gfpflag_names \
17 {(unsigned long)GFP_TRANSHUGE, "GFP_TRANSHUGE"}, \
25160354 18 {(unsigned long)GFP_TRANSHUGE_LIGHT, "GFP_TRANSHUGE_LIGHT"}, \
420adbe9
VB
19 {(unsigned long)GFP_HIGHUSER_MOVABLE, "GFP_HIGHUSER_MOVABLE"},\
20 {(unsigned long)GFP_HIGHUSER, "GFP_HIGHUSER"}, \
21 {(unsigned long)GFP_USER, "GFP_USER"}, \
420adbe9
VB
22 {(unsigned long)GFP_KERNEL_ACCOUNT, "GFP_KERNEL_ACCOUNT"}, \
23 {(unsigned long)GFP_KERNEL, "GFP_KERNEL"}, \
24 {(unsigned long)GFP_NOFS, "GFP_NOFS"}, \
25 {(unsigned long)GFP_ATOMIC, "GFP_ATOMIC"}, \
26 {(unsigned long)GFP_NOIO, "GFP_NOIO"}, \
27 {(unsigned long)GFP_NOWAIT, "GFP_NOWAIT"}, \
28 {(unsigned long)GFP_DMA, "GFP_DMA"}, \
29 {(unsigned long)__GFP_HIGHMEM, "__GFP_HIGHMEM"}, \
30 {(unsigned long)GFP_DMA32, "GFP_DMA32"}, \
31 {(unsigned long)__GFP_HIGH, "__GFP_HIGH"}, \
32 {(unsigned long)__GFP_ATOMIC, "__GFP_ATOMIC"}, \
33 {(unsigned long)__GFP_IO, "__GFP_IO"}, \
34 {(unsigned long)__GFP_FS, "__GFP_FS"}, \
420adbe9 35 {(unsigned long)__GFP_NOWARN, "__GFP_NOWARN"}, \
dcda9b04 36 {(unsigned long)__GFP_RETRY_MAYFAIL, "__GFP_RETRY_MAYFAIL"}, \
420adbe9
VB
37 {(unsigned long)__GFP_NOFAIL, "__GFP_NOFAIL"}, \
38 {(unsigned long)__GFP_NORETRY, "__GFP_NORETRY"}, \
39 {(unsigned long)__GFP_COMP, "__GFP_COMP"}, \
40 {(unsigned long)__GFP_ZERO, "__GFP_ZERO"}, \
41 {(unsigned long)__GFP_NOMEMALLOC, "__GFP_NOMEMALLOC"}, \
42 {(unsigned long)__GFP_MEMALLOC, "__GFP_MEMALLOC"}, \
43 {(unsigned long)__GFP_HARDWALL, "__GFP_HARDWALL"}, \
44 {(unsigned long)__GFP_THISNODE, "__GFP_THISNODE"}, \
45 {(unsigned long)__GFP_RECLAIMABLE, "__GFP_RECLAIMABLE"}, \
46 {(unsigned long)__GFP_MOVABLE, "__GFP_MOVABLE"}, \
47 {(unsigned long)__GFP_ACCOUNT, "__GFP_ACCOUNT"}, \
420adbe9
VB
48 {(unsigned long)__GFP_WRITE, "__GFP_WRITE"}, \
49 {(unsigned long)__GFP_RECLAIM, "__GFP_RECLAIM"}, \
50 {(unsigned long)__GFP_DIRECT_RECLAIM, "__GFP_DIRECT_RECLAIM"},\
b16ee0f9
MR
51 {(unsigned long)__GFP_KSWAPD_RECLAIM, "__GFP_KSWAPD_RECLAIM"},\
52 {(unsigned long)__GFP_ZEROTAGS, "__GFP_ZEROTAGS"}, \
53 {(unsigned long)__GFP_SKIP_KASAN_POISON,"__GFP_SKIP_KASAN_POISON"}\
420adbe9
VB
54
55#define show_gfp_flags(flags) \
56 (flags) ? __print_flags(flags, "|", \
57 __def_gfpflag_names \
58 ) : "none"
59
60#ifdef CONFIG_MMU
61#define IF_HAVE_PG_MLOCK(flag,string) ,{1UL << flag, string}
62#else
63#define IF_HAVE_PG_MLOCK(flag,string)
64#endif
65
66#ifdef CONFIG_ARCH_USES_PG_UNCACHED
67#define IF_HAVE_PG_UNCACHED(flag,string) ,{1UL << flag, string}
68#else
69#define IF_HAVE_PG_UNCACHED(flag,string)
70#endif
71
72#ifdef CONFIG_MEMORY_FAILURE
73#define IF_HAVE_PG_HWPOISON(flag,string) ,{1UL << flag, string}
74#else
75#define IF_HAVE_PG_HWPOISON(flag,string)
76#endif
77
1c676e0d 78#if defined(CONFIG_PAGE_IDLE_FLAG) && defined(CONFIG_64BIT)
420adbe9
VB
79#define IF_HAVE_PG_IDLE(flag,string) ,{1UL << flag, string}
80#else
81#define IF_HAVE_PG_IDLE(flag,string)
82#endif
83
4beba948
SP
84#ifdef CONFIG_64BIT
85#define IF_HAVE_PG_ARCH_2(flag,string) ,{1UL << flag, string}
86#else
87#define IF_HAVE_PG_ARCH_2(flag,string)
88#endif
89
c275c5c6
PC
90#ifdef CONFIG_KASAN_HW_TAGS
91#define IF_HAVE_PG_SKIP_KASAN_POISON(flag,string) ,{1UL << flag, string}
92#else
93#define IF_HAVE_PG_SKIP_KASAN_POISON(flag,string)
94#endif
95
420adbe9
VB
96#define __def_pageflag_names \
97 {1UL << PG_locked, "locked" }, \
62906027 98 {1UL << PG_waiters, "waiters" }, \
420adbe9
VB
99 {1UL << PG_error, "error" }, \
100 {1UL << PG_referenced, "referenced" }, \
101 {1UL << PG_uptodate, "uptodate" }, \
102 {1UL << PG_dirty, "dirty" }, \
103 {1UL << PG_lru, "lru" }, \
104 {1UL << PG_active, "active" }, \
1899ad18 105 {1UL << PG_workingset, "workingset" }, \
420adbe9
VB
106 {1UL << PG_slab, "slab" }, \
107 {1UL << PG_owner_priv_1, "owner_priv_1" }, \
108 {1UL << PG_arch_1, "arch_1" }, \
109 {1UL << PG_reserved, "reserved" }, \
110 {1UL << PG_private, "private" }, \
111 {1UL << PG_private_2, "private_2" }, \
112 {1UL << PG_writeback, "writeback" }, \
113 {1UL << PG_head, "head" }, \
420adbe9
VB
114 {1UL << PG_mappedtodisk, "mappedtodisk" }, \
115 {1UL << PG_reclaim, "reclaim" }, \
116 {1UL << PG_swapbacked, "swapbacked" }, \
117 {1UL << PG_unevictable, "unevictable" } \
118IF_HAVE_PG_MLOCK(PG_mlocked, "mlocked" ) \
119IF_HAVE_PG_UNCACHED(PG_uncached, "uncached" ) \
120IF_HAVE_PG_HWPOISON(PG_hwpoison, "hwpoison" ) \
121IF_HAVE_PG_IDLE(PG_young, "young" ) \
4beba948 122IF_HAVE_PG_IDLE(PG_idle, "idle" ) \
c275c5c6
PC
123IF_HAVE_PG_ARCH_2(PG_arch_2, "arch_2" ) \
124IF_HAVE_PG_SKIP_KASAN_POISON(PG_skip_kasan_poison, "skip_kasan_poison")
420adbe9
VB
125
126#define show_page_flags(flags) \
127 (flags) ? __print_flags(flags, "|", \
128 __def_pageflag_names \
129 ) : "none"
130
131#if defined(CONFIG_X86)
bcf66917 132#define __VM_ARCH_SPECIFIC_1 {VM_PAT, "pat" }
12564485
SA
133#elif defined(CONFIG_PPC)
134#define __VM_ARCH_SPECIFIC_1 {VM_SAO, "sao" }
5f171577 135#elif defined(CONFIG_PARISC) || defined(CONFIG_IA64)
bcf66917 136#define __VM_ARCH_SPECIFIC_1 {VM_GROWSUP, "growsup" }
420adbe9 137#elif !defined(CONFIG_MMU)
bcf66917 138#define __VM_ARCH_SPECIFIC_1 {VM_MAPPED_COPY,"mappedcopy" }
420adbe9 139#else
bcf66917
KS
140#define __VM_ARCH_SPECIFIC_1 {VM_ARCH_1, "arch_1" }
141#endif
142
420adbe9
VB
143#ifdef CONFIG_MEM_SOFT_DIRTY
144#define IF_HAVE_VM_SOFTDIRTY(flag,name) {flag, name },
145#else
146#define IF_HAVE_VM_SOFTDIRTY(flag,name)
147#endif
148
7677f7fd
AR
149#ifdef CONFIG_HAVE_ARCH_USERFAULTFD_MINOR
150# define IF_HAVE_UFFD_MINOR(flag, name) {flag, name},
151#else
152# define IF_HAVE_UFFD_MINOR(flag, name)
153#endif
154
420adbe9
VB
155#define __def_vmaflag_names \
156 {VM_READ, "read" }, \
157 {VM_WRITE, "write" }, \
158 {VM_EXEC, "exec" }, \
159 {VM_SHARED, "shared" }, \
160 {VM_MAYREAD, "mayread" }, \
161 {VM_MAYWRITE, "maywrite" }, \
162 {VM_MAYEXEC, "mayexec" }, \
163 {VM_MAYSHARE, "mayshare" }, \
164 {VM_GROWSDOWN, "growsdown" }, \
bcf66917 165 {VM_UFFD_MISSING, "uffd_missing" }, \
7677f7fd 166IF_HAVE_UFFD_MINOR(VM_UFFD_MINOR, "uffd_minor" ) \
420adbe9 167 {VM_PFNMAP, "pfnmap" }, \
bcf66917 168 {VM_UFFD_WP, "uffd_wp" }, \
420adbe9
VB
169 {VM_LOCKED, "locked" }, \
170 {VM_IO, "io" }, \
171 {VM_SEQ_READ, "seqread" }, \
172 {VM_RAND_READ, "randread" }, \
173 {VM_DONTCOPY, "dontcopy" }, \
174 {VM_DONTEXPAND, "dontexpand" }, \
bcf66917 175 {VM_LOCKONFAULT, "lockonfault" }, \
420adbe9
VB
176 {VM_ACCOUNT, "account" }, \
177 {VM_NORESERVE, "noreserve" }, \
178 {VM_HUGETLB, "hugetlb" }, \
7e96fb57 179 {VM_SYNC, "sync" }, \
bcf66917 180 __VM_ARCH_SPECIFIC_1 , \
d2cd9ede 181 {VM_WIPEONFORK, "wipeonfork" }, \
420adbe9
VB
182 {VM_DONTDUMP, "dontdump" }, \
183IF_HAVE_VM_SOFTDIRTY(VM_SOFTDIRTY, "softdirty" ) \
184 {VM_MIXEDMAP, "mixedmap" }, \
185 {VM_HUGEPAGE, "hugepage" }, \
186 {VM_NOHUGEPAGE, "nohugepage" }, \
187 {VM_MERGEABLE, "mergeable" } \
188
189#define show_vma_flags(flags) \
190 (flags) ? __print_flags(flags, "|", \
191 __def_vmaflag_names \
192 ) : "none"
aff28015
MH
193
194#ifdef CONFIG_COMPACTION
195#define COMPACTION_STATUS \
196 EM( COMPACT_SKIPPED, "skipped") \
197 EM( COMPACT_DEFERRED, "deferred") \
198 EM( COMPACT_CONTINUE, "continue") \
199 EM( COMPACT_SUCCESS, "success") \
200 EM( COMPACT_PARTIAL_SKIPPED, "partial_skipped") \
201 EM( COMPACT_COMPLETE, "complete") \
202 EM( COMPACT_NO_SUITABLE_PAGE, "no_suitable_page") \
203 EM( COMPACT_NOT_SUITABLE_ZONE, "not_suitable_zone") \
204 EMe(COMPACT_CONTENDED, "contended")
65190cff
MH
205
206/* High-level compaction status feedback */
207#define COMPACTION_FAILED 1
208#define COMPACTION_WITHDRAWN 2
209#define COMPACTION_PROGRESS 3
210
211#define compact_result_to_feedback(result) \
212({ \
213 enum compact_result __result = result; \
214 (compaction_failed(__result)) ? COMPACTION_FAILED : \
215 (compaction_withdrawn(__result)) ? COMPACTION_WITHDRAWN : COMPACTION_PROGRESS; \
216})
217
218#define COMPACTION_FEEDBACK \
219 EM(COMPACTION_FAILED, "failed") \
220 EM(COMPACTION_WITHDRAWN, "withdrawn") \
221 EMe(COMPACTION_PROGRESS, "progress")
222
223#define COMPACTION_PRIORITY \
224 EM(COMPACT_PRIO_SYNC_FULL, "COMPACT_PRIO_SYNC_FULL") \
225 EM(COMPACT_PRIO_SYNC_LIGHT, "COMPACT_PRIO_SYNC_LIGHT") \
226 EMe(COMPACT_PRIO_ASYNC, "COMPACT_PRIO_ASYNC")
aff28015
MH
227#else
228#define COMPACTION_STATUS
65190cff
MH
229#define COMPACTION_PRIORITY
230#define COMPACTION_FEEDBACK
aff28015
MH
231#endif
232
233#ifdef CONFIG_ZONE_DMA
234#define IFDEF_ZONE_DMA(X) X
235#else
236#define IFDEF_ZONE_DMA(X)
237#endif
238
239#ifdef CONFIG_ZONE_DMA32
240#define IFDEF_ZONE_DMA32(X) X
241#else
242#define IFDEF_ZONE_DMA32(X)
243#endif
244
245#ifdef CONFIG_HIGHMEM
246#define IFDEF_ZONE_HIGHMEM(X) X
247#else
248#define IFDEF_ZONE_HIGHMEM(X)
249#endif
250
251#define ZONE_TYPE \
252 IFDEF_ZONE_DMA( EM (ZONE_DMA, "DMA")) \
253 IFDEF_ZONE_DMA32( EM (ZONE_DMA32, "DMA32")) \
254 EM (ZONE_NORMAL, "Normal") \
255 IFDEF_ZONE_HIGHMEM( EM (ZONE_HIGHMEM,"HighMem")) \
256 EMe(ZONE_MOVABLE,"Movable")
257
32b3f297
MH
258#define LRU_NAMES \
259 EM (LRU_INACTIVE_ANON, "inactive_anon") \
260 EM (LRU_ACTIVE_ANON, "active_anon") \
261 EM (LRU_INACTIVE_FILE, "inactive_file") \
262 EM (LRU_ACTIVE_FILE, "active_file") \
263 EMe(LRU_UNEVICTABLE, "unevictable")
264
aff28015
MH
265/*
266 * First define the enums in the above macros to be exported to userspace
267 * via TRACE_DEFINE_ENUM().
268 */
269#undef EM
270#undef EMe
271#define EM(a, b) TRACE_DEFINE_ENUM(a);
272#define EMe(a, b) TRACE_DEFINE_ENUM(a);
273
274COMPACTION_STATUS
65190cff 275COMPACTION_PRIORITY
7ab0e50a 276/* COMPACTION_FEEDBACK are defines not enums. Not needed here. */
aff28015 277ZONE_TYPE
32b3f297 278LRU_NAMES
aff28015
MH
279
280/*
281 * Now redefine the EM() and EMe() macros to map the enums to the strings
282 * that will be printed in the output.
283 */
284#undef EM
285#undef EMe
286#define EM(a, b) {a, b},
287#define EMe(a, b) {a, b}