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 #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
102 		THP_SPLIT_PUD,
103 #endif
104 		THP_ZERO_PAGE_ALLOC,
105 		THP_ZERO_PAGE_ALLOC_FAILED,
106 		THP_SWPOUT,
107 		THP_SWPOUT_FALLBACK,
108 #endif
109 #ifdef CONFIG_MEMORY_BALLOON
110 		BALLOON_INFLATE,
111 		BALLOON_DEFLATE,
112 #ifdef CONFIG_BALLOON_COMPACTION
113 		BALLOON_MIGRATE,
114 #endif
115 #endif
116 #ifdef CONFIG_DEBUG_TLBFLUSH
117 		NR_TLB_REMOTE_FLUSH,	/* cpu tried to flush others' tlbs */
118 		NR_TLB_REMOTE_FLUSH_RECEIVED,/* cpu received ipi for flush */
119 		NR_TLB_LOCAL_FLUSH_ALL,
120 		NR_TLB_LOCAL_FLUSH_ONE,
121 #endif /* CONFIG_DEBUG_TLBFLUSH */
122 #ifdef CONFIG_DEBUG_VM_VMACACHE
123 		VMACACHE_FIND_CALLS,
124 		VMACACHE_FIND_HITS,
125 #endif
126 #ifdef CONFIG_SWAP
127 		SWAP_RA,
128 		SWAP_RA_HIT,
129 #endif
130 #ifdef CONFIG_X86
131 		DIRECT_MAP_LEVEL2_SPLIT,
132 		DIRECT_MAP_LEVEL3_SPLIT,
133 #endif
134 		NR_VM_EVENT_ITEMS
135 };
136 
137 #ifndef CONFIG_TRANSPARENT_HUGEPAGE
138 #define THP_FILE_ALLOC ({ BUILD_BUG(); 0; })
139 #define THP_FILE_FALLBACK ({ BUILD_BUG(); 0; })
140 #define THP_FILE_FALLBACK_CHARGE ({ BUILD_BUG(); 0; })
141 #define THP_FILE_MAPPED ({ BUILD_BUG(); 0; })
142 #endif
143 
144 #endif		/* VM_EVENT_ITEM_H_INCLUDED */
145