xref: /linux/include/linux/vm_event_item.h (revision 4b49c0ba4eeb31b44462303cac4162476b72c831)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef VM_EVENT_ITEM_H_INCLUDED
3 #define VM_EVENT_ITEM_H_INCLUDED
4 
5 #ifdef CONFIG_ZONE_DMA
6 #define DMA_ZONE(xx) xx##_DMA,
7 #else
8 #define DMA_ZONE(xx)
9 #endif
10 
11 #ifdef CONFIG_ZONE_DMA32
12 #define DMA32_ZONE(xx) xx##_DMA32,
13 #else
14 #define DMA32_ZONE(xx)
15 #endif
16 
17 #ifdef CONFIG_HIGHMEM
18 #define HIGHMEM_ZONE(xx) xx##_HIGH,
19 #else
20 #define HIGHMEM_ZONE(xx)
21 #endif
22 
23 #ifdef CONFIG_ZONE_DEVICE
24 #define DEVICE_ZONE(xx) xx##_DEVICE,
25 #else
26 #define DEVICE_ZONE(xx)
27 #endif
28 
29 #define FOR_ALL_ZONES(xx) DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
30 	HIGHMEM_ZONE(xx) xx##_MOVABLE, DEVICE_ZONE(xx)
31 
32 enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
33 		FOR_ALL_ZONES(PGALLOC)
34 		FOR_ALL_ZONES(ALLOCSTALL)
35 		FOR_ALL_ZONES(PGSCAN_SKIP)
36 		PGFREE, PGACTIVATE, PGDEACTIVATE, PGLAZYFREE,
37 		PGFAULT, PGMAJFAULT,
38 		PGLAZYFREED,
39 		PGREFILL,
40 		PGREUSE,
41 		PGSTEAL_KSWAPD,
42 		PGSTEAL_DIRECT,
43 		PGSTEAL_KHUGEPAGED,
44 		PGSCAN_KSWAPD,
45 		PGSCAN_DIRECT,
46 		PGSCAN_KHUGEPAGED,
47 		PGSCAN_DIRECT_THROTTLE,
48 		PGSCAN_ANON,
49 		PGSCAN_FILE,
50 		PGSTEAL_ANON,
51 		PGSTEAL_FILE,
52 #ifdef CONFIG_NUMA
53 		PGSCAN_ZONE_RECLAIM_SUCCESS,
54 		PGSCAN_ZONE_RECLAIM_FAILED,
55 #endif
56 		PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL,
57 		KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
58 		PAGEOUTRUN, PGROTATED,
59 		DROP_PAGECACHE, DROP_SLAB,
60 		OOM_KILL,
61 #ifdef CONFIG_NUMA_BALANCING
62 		NUMA_PTE_UPDATES,
63 		NUMA_HUGE_PTE_UPDATES,
64 		NUMA_HINT_FAULTS,
65 		NUMA_HINT_FAULTS_LOCAL,
66 		NUMA_PAGE_MIGRATE,
67 #endif
68 #ifdef CONFIG_MIGRATION
69 		PGMIGRATE_SUCCESS, PGMIGRATE_FAIL,
70 		THP_MIGRATION_SUCCESS,
71 		THP_MIGRATION_FAIL,
72 		THP_MIGRATION_SPLIT,
73 #endif
74 #ifdef CONFIG_COMPACTION
75 		COMPACTMIGRATE_SCANNED, COMPACTFREE_SCANNED,
76 		COMPACTISOLATED,
77 		COMPACTSTALL, COMPACTFAIL, COMPACTSUCCESS,
78 		KCOMPACTD_WAKE,
79 		KCOMPACTD_MIGRATE_SCANNED, KCOMPACTD_FREE_SCANNED,
80 #endif
81 #ifdef CONFIG_HUGETLB_PAGE
82 		HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
83 #endif
84 #ifdef CONFIG_CMA
85 		CMA_ALLOC_SUCCESS,
86 		CMA_ALLOC_FAIL,
87 #endif
88 		UNEVICTABLE_PGCULLED,	/* culled to noreclaim list */
89 		UNEVICTABLE_PGSCANNED,	/* scanned for reclaimability */
90 		UNEVICTABLE_PGRESCUED,	/* rescued from noreclaim list */
91 		UNEVICTABLE_PGMLOCKED,
92 		UNEVICTABLE_PGMUNLOCKED,
93 		UNEVICTABLE_PGCLEARED,	/* on COW, page truncate */
94 		UNEVICTABLE_PGSTRANDED,	/* unable to isolate on unlock */
95 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
96 		THP_FAULT_ALLOC,
97 		THP_FAULT_FALLBACK,
98 		THP_FAULT_FALLBACK_CHARGE,
99 		THP_COLLAPSE_ALLOC,
100 		THP_COLLAPSE_ALLOC_FAILED,
101 		THP_FILE_ALLOC,
102 		THP_FILE_FALLBACK,
103 		THP_FILE_FALLBACK_CHARGE,
104 		THP_FILE_MAPPED,
105 		THP_SPLIT_PAGE,
106 		THP_SPLIT_PAGE_FAILED,
107 		THP_DEFERRED_SPLIT_PAGE,
108 		THP_UNDERUSED_SPLIT_PAGE,
109 		THP_SPLIT_PMD,
110 		THP_SCAN_EXCEED_NONE_PTE,
111 		THP_SCAN_EXCEED_SWAP_PTE,
112 		THP_SCAN_EXCEED_SHARED_PTE,
113 #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
114 		THP_SPLIT_PUD,
115 #endif
116 		THP_ZERO_PAGE_ALLOC,
117 		THP_ZERO_PAGE_ALLOC_FAILED,
118 		THP_SWPOUT,
119 		THP_SWPOUT_FALLBACK,
120 #endif
121 #ifdef CONFIG_MEMORY_BALLOON
122 		BALLOON_INFLATE,
123 		BALLOON_DEFLATE,
124 #ifdef CONFIG_BALLOON_COMPACTION
125 		BALLOON_MIGRATE,
126 #endif
127 #endif
128 #ifdef CONFIG_DEBUG_TLBFLUSH
129 		NR_TLB_REMOTE_FLUSH,	/* cpu tried to flush others' tlbs */
130 		NR_TLB_REMOTE_FLUSH_RECEIVED,/* cpu received ipi for flush */
131 		NR_TLB_LOCAL_FLUSH_ALL,
132 		NR_TLB_LOCAL_FLUSH_ONE,
133 #endif /* CONFIG_DEBUG_TLBFLUSH */
134 #ifdef CONFIG_SWAP
135 		SWAP_RA,
136 		SWAP_RA_HIT,
137 		SWPIN_ZERO,
138 		SWPOUT_ZERO,
139 #ifdef CONFIG_KSM
140 		KSM_SWPIN_COPY,
141 #endif
142 #endif
143 #ifdef CONFIG_KSM
144 		COW_KSM,
145 #endif
146 #ifdef CONFIG_ZSWAP
147 		ZSWPIN,
148 		ZSWPOUT,
149 		ZSWPWB,
150 #endif
151 #ifdef CONFIG_X86
152 		DIRECT_MAP_LEVEL2_SPLIT,
153 		DIRECT_MAP_LEVEL3_SPLIT,
154 #endif
155 #ifdef CONFIG_PER_VMA_LOCK_STATS
156 		VMA_LOCK_SUCCESS,
157 		VMA_LOCK_ABORT,
158 		VMA_LOCK_RETRY,
159 		VMA_LOCK_MISS,
160 #endif
161 #ifdef CONFIG_DEBUG_STACK_USAGE
162 		KSTACK_1K,
163 #if THREAD_SIZE > 1024
164 		KSTACK_2K,
165 #endif
166 #if THREAD_SIZE > 2048
167 		KSTACK_4K,
168 #endif
169 #if THREAD_SIZE > 4096
170 		KSTACK_8K,
171 #endif
172 #if THREAD_SIZE > 8192
173 		KSTACK_16K,
174 #endif
175 #if THREAD_SIZE > 16384
176 		KSTACK_32K,
177 #endif
178 #if THREAD_SIZE > 32768
179 		KSTACK_64K,
180 #endif
181 #if THREAD_SIZE > 65536
182 		KSTACK_REST,
183 #endif
184 #endif /* CONFIG_DEBUG_STACK_USAGE */
185 		NR_VM_EVENT_ITEMS
186 };
187 
188 #ifndef CONFIG_TRANSPARENT_HUGEPAGE
189 #define THP_FILE_ALLOC ({ BUILD_BUG(); 0; })
190 #define THP_FILE_FALLBACK ({ BUILD_BUG(); 0; })
191 #define THP_FILE_FALLBACK_CHARGE ({ BUILD_BUG(); 0; })
192 #define THP_FILE_MAPPED ({ BUILD_BUG(); 0; })
193 #endif
194 
195 #endif		/* VM_EVENT_ITEM_H_INCLUDED */
196