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