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