xref: /linux/include/trace/events/mmflags.h (revision d257f9bf06129613de539ea71ecea60848b662cd)
1 #include <linux/node.h>
2 #include <linux/mmzone.h>
3 #include <linux/compaction.h>
4 /*
5  * The order of these masks is important. Matching masks will be seen
6  * first and the left over flags will end up showing by themselves.
7  *
8  * For example, if we have GFP_KERNEL before GFP_USER we wil get:
9  *
10  *  GFP_KERNEL|GFP_HARDWALL
11  *
12  * Thus most bits set go first.
13  */
14 
15 #define __def_gfpflag_names						\
16 	{(unsigned long)GFP_TRANSHUGE,		"GFP_TRANSHUGE"},	\
17 	{(unsigned long)GFP_TRANSHUGE_LIGHT,	"GFP_TRANSHUGE_LIGHT"}, \
18 	{(unsigned long)GFP_HIGHUSER_MOVABLE,	"GFP_HIGHUSER_MOVABLE"},\
19 	{(unsigned long)GFP_HIGHUSER,		"GFP_HIGHUSER"},	\
20 	{(unsigned long)GFP_USER,		"GFP_USER"},		\
21 	{(unsigned long)GFP_TEMPORARY,		"GFP_TEMPORARY"},	\
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"},		\
35 	{(unsigned long)__GFP_COLD,		"__GFP_COLD"},		\
36 	{(unsigned long)__GFP_NOWARN,		"__GFP_NOWARN"},	\
37 	{(unsigned long)__GFP_RETRY_MAYFAIL,	"__GFP_RETRY_MAYFAIL"},	\
38 	{(unsigned long)__GFP_NOFAIL,		"__GFP_NOFAIL"},	\
39 	{(unsigned long)__GFP_NORETRY,		"__GFP_NORETRY"},	\
40 	{(unsigned long)__GFP_COMP,		"__GFP_COMP"},		\
41 	{(unsigned long)__GFP_ZERO,		"__GFP_ZERO"},		\
42 	{(unsigned long)__GFP_NOMEMALLOC,	"__GFP_NOMEMALLOC"},	\
43 	{(unsigned long)__GFP_MEMALLOC,		"__GFP_MEMALLOC"},	\
44 	{(unsigned long)__GFP_HARDWALL,		"__GFP_HARDWALL"},	\
45 	{(unsigned long)__GFP_THISNODE,		"__GFP_THISNODE"},	\
46 	{(unsigned long)__GFP_RECLAIMABLE,	"__GFP_RECLAIMABLE"},	\
47 	{(unsigned long)__GFP_MOVABLE,		"__GFP_MOVABLE"},	\
48 	{(unsigned long)__GFP_ACCOUNT,		"__GFP_ACCOUNT"},	\
49 	{(unsigned long)__GFP_NOTRACK,		"__GFP_NOTRACK"},	\
50 	{(unsigned long)__GFP_WRITE,		"__GFP_WRITE"},		\
51 	{(unsigned long)__GFP_RECLAIM,		"__GFP_RECLAIM"},	\
52 	{(unsigned long)__GFP_DIRECT_RECLAIM,	"__GFP_DIRECT_RECLAIM"},\
53 	{(unsigned long)__GFP_KSWAPD_RECLAIM,	"__GFP_KSWAPD_RECLAIM"}\
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 
78 #if defined(CONFIG_IDLE_PAGE_TRACKING) && defined(CONFIG_64BIT)
79 #define IF_HAVE_PG_IDLE(flag,string) ,{1UL << flag, string}
80 #else
81 #define IF_HAVE_PG_IDLE(flag,string)
82 #endif
83 
84 #define __def_pageflag_names						\
85 	{1UL << PG_locked,		"locked"	},		\
86 	{1UL << PG_waiters,		"waiters"	},		\
87 	{1UL << PG_error,		"error"		},		\
88 	{1UL << PG_referenced,		"referenced"	},		\
89 	{1UL << PG_uptodate,		"uptodate"	},		\
90 	{1UL << PG_dirty,		"dirty"		},		\
91 	{1UL << PG_lru,			"lru"		},		\
92 	{1UL << PG_active,		"active"	},		\
93 	{1UL << PG_slab,		"slab"		},		\
94 	{1UL << PG_owner_priv_1,	"owner_priv_1"	},		\
95 	{1UL << PG_arch_1,		"arch_1"	},		\
96 	{1UL << PG_reserved,		"reserved"	},		\
97 	{1UL << PG_private,		"private"	},		\
98 	{1UL << PG_private_2,		"private_2"	},		\
99 	{1UL << PG_writeback,		"writeback"	},		\
100 	{1UL << PG_head,		"head"		},		\
101 	{1UL << PG_mappedtodisk,	"mappedtodisk"	},		\
102 	{1UL << PG_reclaim,		"reclaim"	},		\
103 	{1UL << PG_swapbacked,		"swapbacked"	},		\
104 	{1UL << PG_unevictable,		"unevictable"	}		\
105 IF_HAVE_PG_MLOCK(PG_mlocked,		"mlocked"	)		\
106 IF_HAVE_PG_UNCACHED(PG_uncached,	"uncached"	)		\
107 IF_HAVE_PG_HWPOISON(PG_hwpoison,	"hwpoison"	)		\
108 IF_HAVE_PG_IDLE(PG_young,		"young"		)		\
109 IF_HAVE_PG_IDLE(PG_idle,		"idle"		)
110 
111 #define show_page_flags(flags)						\
112 	(flags) ? __print_flags(flags, "|",				\
113 	__def_pageflag_names						\
114 	) : "none"
115 
116 #if defined(CONFIG_X86)
117 #define __VM_ARCH_SPECIFIC_1 {VM_PAT,     "pat"           }
118 #elif defined(CONFIG_PPC)
119 #define __VM_ARCH_SPECIFIC_1 {VM_SAO,     "sao"           }
120 #elif defined(CONFIG_PARISC) || defined(CONFIG_METAG) || defined(CONFIG_IA64)
121 #define __VM_ARCH_SPECIFIC_1 {VM_GROWSUP,	"growsup"	}
122 #elif !defined(CONFIG_MMU)
123 #define __VM_ARCH_SPECIFIC_1 {VM_MAPPED_COPY,"mappedcopy"	}
124 #else
125 #define __VM_ARCH_SPECIFIC_1 {VM_ARCH_1,	"arch_1"	}
126 #endif
127 
128 #if defined(CONFIG_X86)
129 #define __VM_ARCH_SPECIFIC_2 {VM_MPX,		"mpx"		}
130 #else
131 #define __VM_ARCH_SPECIFIC_2 {VM_ARCH_2,	"arch_2"	}
132 #endif
133 
134 #ifdef CONFIG_MEM_SOFT_DIRTY
135 #define IF_HAVE_VM_SOFTDIRTY(flag,name) {flag, name },
136 #else
137 #define IF_HAVE_VM_SOFTDIRTY(flag,name)
138 #endif
139 
140 #define __def_vmaflag_names						\
141 	{VM_READ,			"read"		},		\
142 	{VM_WRITE,			"write"		},		\
143 	{VM_EXEC,			"exec"		},		\
144 	{VM_SHARED,			"shared"	},		\
145 	{VM_MAYREAD,			"mayread"	},		\
146 	{VM_MAYWRITE,			"maywrite"	},		\
147 	{VM_MAYEXEC,			"mayexec"	},		\
148 	{VM_MAYSHARE,			"mayshare"	},		\
149 	{VM_GROWSDOWN,			"growsdown"	},		\
150 	{VM_UFFD_MISSING,		"uffd_missing"	},		\
151 	{VM_PFNMAP,			"pfnmap"	},		\
152 	{VM_DENYWRITE,			"denywrite"	},		\
153 	{VM_UFFD_WP,			"uffd_wp"	},		\
154 	{VM_LOCKED,			"locked"	},		\
155 	{VM_IO,				"io"		},		\
156 	{VM_SEQ_READ,			"seqread"	},		\
157 	{VM_RAND_READ,			"randread"	},		\
158 	{VM_DONTCOPY,			"dontcopy"	},		\
159 	{VM_DONTEXPAND,			"dontexpand"	},		\
160 	{VM_LOCKONFAULT,		"lockonfault"	},		\
161 	{VM_ACCOUNT,			"account"	},		\
162 	{VM_NORESERVE,			"noreserve"	},		\
163 	{VM_HUGETLB,			"hugetlb"	},		\
164 	__VM_ARCH_SPECIFIC_1				,		\
165 	__VM_ARCH_SPECIFIC_2				,		\
166 	{VM_DONTDUMP,			"dontdump"	},		\
167 IF_HAVE_VM_SOFTDIRTY(VM_SOFTDIRTY,	"softdirty"	)		\
168 	{VM_MIXEDMAP,			"mixedmap"	},		\
169 	{VM_HUGEPAGE,			"hugepage"	},		\
170 	{VM_NOHUGEPAGE,			"nohugepage"	},		\
171 	{VM_MERGEABLE,			"mergeable"	}		\
172 
173 #define show_vma_flags(flags)						\
174 	(flags) ? __print_flags(flags, "|",				\
175 	__def_vmaflag_names						\
176 	) : "none"
177 
178 #ifdef CONFIG_COMPACTION
179 #define COMPACTION_STATUS					\
180 	EM( COMPACT_SKIPPED,		"skipped")		\
181 	EM( COMPACT_DEFERRED,		"deferred")		\
182 	EM( COMPACT_CONTINUE,		"continue")		\
183 	EM( COMPACT_SUCCESS,		"success")		\
184 	EM( COMPACT_PARTIAL_SKIPPED,	"partial_skipped")	\
185 	EM( COMPACT_COMPLETE,		"complete")		\
186 	EM( COMPACT_NO_SUITABLE_PAGE,	"no_suitable_page")	\
187 	EM( COMPACT_NOT_SUITABLE_ZONE,	"not_suitable_zone")	\
188 	EMe(COMPACT_CONTENDED,		"contended")
189 
190 /* High-level compaction status feedback */
191 #define COMPACTION_FAILED	1
192 #define COMPACTION_WITHDRAWN	2
193 #define COMPACTION_PROGRESS	3
194 
195 #define compact_result_to_feedback(result)	\
196 ({						\
197 	enum compact_result __result = result;	\
198 	(compaction_failed(__result)) ? COMPACTION_FAILED : \
199 		(compaction_withdrawn(__result)) ? COMPACTION_WITHDRAWN : COMPACTION_PROGRESS; \
200 })
201 
202 #define COMPACTION_FEEDBACK		\
203 	EM(COMPACTION_FAILED,		"failed")	\
204 	EM(COMPACTION_WITHDRAWN,	"withdrawn")	\
205 	EMe(COMPACTION_PROGRESS,	"progress")
206 
207 #define COMPACTION_PRIORITY						\
208 	EM(COMPACT_PRIO_SYNC_FULL,	"COMPACT_PRIO_SYNC_FULL")	\
209 	EM(COMPACT_PRIO_SYNC_LIGHT,	"COMPACT_PRIO_SYNC_LIGHT")	\
210 	EMe(COMPACT_PRIO_ASYNC,		"COMPACT_PRIO_ASYNC")
211 #else
212 #define COMPACTION_STATUS
213 #define COMPACTION_PRIORITY
214 #define COMPACTION_FEEDBACK
215 #endif
216 
217 #ifdef CONFIG_ZONE_DMA
218 #define IFDEF_ZONE_DMA(X) X
219 #else
220 #define IFDEF_ZONE_DMA(X)
221 #endif
222 
223 #ifdef CONFIG_ZONE_DMA32
224 #define IFDEF_ZONE_DMA32(X) X
225 #else
226 #define IFDEF_ZONE_DMA32(X)
227 #endif
228 
229 #ifdef CONFIG_HIGHMEM
230 #define IFDEF_ZONE_HIGHMEM(X) X
231 #else
232 #define IFDEF_ZONE_HIGHMEM(X)
233 #endif
234 
235 #define ZONE_TYPE						\
236 	IFDEF_ZONE_DMA(		EM (ZONE_DMA,	 "DMA"))	\
237 	IFDEF_ZONE_DMA32(	EM (ZONE_DMA32,	 "DMA32"))	\
238 				EM (ZONE_NORMAL, "Normal")	\
239 	IFDEF_ZONE_HIGHMEM(	EM (ZONE_HIGHMEM,"HighMem"))	\
240 				EMe(ZONE_MOVABLE,"Movable")
241 
242 #define LRU_NAMES		\
243 		EM (LRU_INACTIVE_ANON, "inactive_anon") \
244 		EM (LRU_ACTIVE_ANON, "active_anon") \
245 		EM (LRU_INACTIVE_FILE, "inactive_file") \
246 		EM (LRU_ACTIVE_FILE, "active_file") \
247 		EMe(LRU_UNEVICTABLE, "unevictable")
248 
249 /*
250  * First define the enums in the above macros to be exported to userspace
251  * via TRACE_DEFINE_ENUM().
252  */
253 #undef EM
254 #undef EMe
255 #define EM(a, b)	TRACE_DEFINE_ENUM(a);
256 #define EMe(a, b)	TRACE_DEFINE_ENUM(a);
257 
258 COMPACTION_STATUS
259 COMPACTION_PRIORITY
260 /* COMPACTION_FEEDBACK are defines not enums. Not needed here. */
261 ZONE_TYPE
262 LRU_NAMES
263 
264 /*
265  * Now redefine the EM() and EMe() macros to map the enums to the strings
266  * that will be printed in the output.
267  */
268 #undef EM
269 #undef EMe
270 #define EM(a, b)	{a, b},
271 #define EMe(a, b)	{a, b}
272