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 		PGDEMOTE_KSWAPD,
45 		PGDEMOTE_DIRECT,
46 		PGDEMOTE_KHUGEPAGED,
47 		PGSCAN_KSWAPD,
48 		PGSCAN_DIRECT,
49 		PGSCAN_KHUGEPAGED,
50 		PGSCAN_DIRECT_THROTTLE,
51 		PGSCAN_ANON,
52 		PGSCAN_FILE,
53 		PGSTEAL_ANON,
54 		PGSTEAL_FILE,
55 #ifdef CONFIG_NUMA
56 		PGSCAN_ZONE_RECLAIM_FAILED,
57 #endif
58 		PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL,
59 		KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
60 		PAGEOUTRUN, PGROTATED,
61 		DROP_PAGECACHE, DROP_SLAB,
62 		OOM_KILL,
63 #ifdef CONFIG_NUMA_BALANCING
64 		NUMA_PTE_UPDATES,
65 		NUMA_HUGE_PTE_UPDATES,
66 		NUMA_HINT_FAULTS,
67 		NUMA_HINT_FAULTS_LOCAL,
68 		NUMA_PAGE_MIGRATE,
69 #endif
70 #ifdef CONFIG_MIGRATION
71 		PGMIGRATE_SUCCESS, PGMIGRATE_FAIL,
72 		THP_MIGRATION_SUCCESS,
73 		THP_MIGRATION_FAIL,
74 		THP_MIGRATION_SPLIT,
75 #endif
76 #ifdef CONFIG_COMPACTION
77 		COMPACTMIGRATE_SCANNED, COMPACTFREE_SCANNED,
78 		COMPACTISOLATED,
79 		COMPACTSTALL, COMPACTFAIL, COMPACTSUCCESS,
80 		KCOMPACTD_WAKE,
81 		KCOMPACTD_MIGRATE_SCANNED, KCOMPACTD_FREE_SCANNED,
82 #endif
83 #ifdef CONFIG_HUGETLB_PAGE
84 		HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
85 #endif
86 #ifdef CONFIG_CMA
87 		CMA_ALLOC_SUCCESS,
88 		CMA_ALLOC_FAIL,
89 #endif
90 		UNEVICTABLE_PGCULLED,	/* culled to noreclaim list */
91 		UNEVICTABLE_PGSCANNED,	/* scanned for reclaimability */
92 		UNEVICTABLE_PGRESCUED,	/* rescued from noreclaim list */
93 		UNEVICTABLE_PGMLOCKED,
94 		UNEVICTABLE_PGMUNLOCKED,
95 		UNEVICTABLE_PGCLEARED,	/* on COW, page truncate */
96 		UNEVICTABLE_PGSTRANDED,	/* unable to isolate on unlock */
97 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
98 		THP_FAULT_ALLOC,
99 		THP_FAULT_FALLBACK,
100 		THP_FAULT_FALLBACK_CHARGE,
101 		THP_COLLAPSE_ALLOC,
102 		THP_COLLAPSE_ALLOC_FAILED,
103 		THP_FILE_ALLOC,
104 		THP_FILE_FALLBACK,
105 		THP_FILE_FALLBACK_CHARGE,
106 		THP_FILE_MAPPED,
107 		THP_SPLIT_PAGE,
108 		THP_SPLIT_PAGE_FAILED,
109 		THP_DEFERRED_SPLIT_PAGE,
110 		THP_SPLIT_PMD,
111 		THP_SCAN_EXCEED_NONE_PTE,
112 		THP_SCAN_EXCEED_SWAP_PTE,
113 		THP_SCAN_EXCEED_SHARED_PTE,
114 #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
115 		THP_SPLIT_PUD,
116 #endif
117 		THP_ZERO_PAGE_ALLOC,
118 		THP_ZERO_PAGE_ALLOC_FAILED,
119 		THP_SWPOUT,
120 		THP_SWPOUT_FALLBACK,
121 #endif
122 #ifdef CONFIG_MEMORY_BALLOON
123 		BALLOON_INFLATE,
124 		BALLOON_DEFLATE,
125 #ifdef CONFIG_BALLOON_COMPACTION
126 		BALLOON_MIGRATE,
127 #endif
128 #endif
129 #ifdef CONFIG_DEBUG_TLBFLUSH
130 		NR_TLB_REMOTE_FLUSH,	/* cpu tried to flush others' tlbs */
131 		NR_TLB_REMOTE_FLUSH_RECEIVED,/* cpu received ipi for flush */
132 		NR_TLB_LOCAL_FLUSH_ALL,
133 		NR_TLB_LOCAL_FLUSH_ONE,
134 #endif /* CONFIG_DEBUG_TLBFLUSH */
135 #ifdef CONFIG_SWAP
136 		SWAP_RA,
137 		SWAP_RA_HIT,
138 #ifdef CONFIG_KSM
139 		KSM_SWPIN_COPY,
140 #endif
141 #endif
142 #ifdef CONFIG_KSM
143 		COW_KSM,
144 #endif
145 #ifdef CONFIG_ZSWAP
146 		ZSWPIN,
147 		ZSWPOUT,
148 #endif
149 #ifdef CONFIG_X86
150 		DIRECT_MAP_LEVEL2_SPLIT,
151 		DIRECT_MAP_LEVEL3_SPLIT,
152 #endif
153 #ifdef CONFIG_PER_VMA_LOCK_STATS
154 		VMA_LOCK_SUCCESS,
155 		VMA_LOCK_ABORT,
156 		VMA_LOCK_RETRY,
157 		VMA_LOCK_MISS,
158 #endif
159 		NR_VM_EVENT_ITEMS
160 };
161 
162 #ifndef CONFIG_TRANSPARENT_HUGEPAGE
163 #define THP_FILE_ALLOC ({ BUILD_BUG(); 0; })
164 #define THP_FILE_FALLBACK ({ BUILD_BUG(); 0; })
165 #define THP_FILE_FALLBACK_CHARGE ({ BUILD_BUG(); 0; })
166 #define THP_FILE_MAPPED ({ BUILD_BUG(); 0; })
167 #endif
168 
169 #endif		/* VM_EVENT_ITEM_H_INCLUDED */
170