Christoph Lameter | f6ac235 | 2006-06-30 01:55:32 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_VMSTAT_H |
| 2 | #define _LINUX_VMSTAT_H |
| 3 | |
| 4 | #include <linux/types.h> |
| 5 | #include <linux/percpu.h> |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 6 | #include <linux/mmzone.h> |
Andrew Morton | f042e70 | 2011-05-26 16:25:24 -0700 | [diff] [blame] | 7 | #include <linux/vm_event_item.h> |
Arun Sharma | 60063497 | 2011-07-26 16:09:06 -0700 | [diff] [blame] | 8 | #include <linux/atomic.h> |
Christoph Lameter | f6ac235 | 2006-06-30 01:55:32 -0700 | [diff] [blame] | 9 | |
Adrian Bunk | c748e13 | 2008-07-23 21:27:03 -0700 | [diff] [blame] | 10 | extern int sysctl_stat_interval; |
| 11 | |
Andrew Morton | 780a065 | 2007-02-10 01:44:41 -0800 | [diff] [blame] | 12 | #ifdef CONFIG_VM_EVENT_COUNTERS |
| 13 | /* |
| 14 | * Light weight per cpu counter implementation. |
| 15 | * |
| 16 | * Counters should only be incremented and no critical kernel component |
| 17 | * should rely on the counter values. |
| 18 | * |
| 19 | * Counters are handled completely inline. On many platforms the code |
| 20 | * generated will simply be the increment of a global address. |
| 21 | */ |
| 22 | |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 23 | struct vm_event_state { |
| 24 | unsigned long event[NR_VM_EVENT_ITEMS]; |
| 25 | }; |
Christoph Lameter | f6ac235 | 2006-06-30 01:55:32 -0700 | [diff] [blame] | 26 | |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 27 | DECLARE_PER_CPU(struct vm_event_state, vm_event_states); |
Christoph Lameter | f6ac235 | 2006-06-30 01:55:32 -0700 | [diff] [blame] | 28 | |
Christoph Lameter | 293b6a4 | 2014-04-07 15:39:43 -0700 | [diff] [blame] | 29 | /* |
| 30 | * vm counters are allowed to be racy. Use raw_cpu_ops to avoid the |
| 31 | * local_irq_disable overhead. |
| 32 | */ |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 33 | static inline void __count_vm_event(enum vm_event_item item) |
| 34 | { |
Christoph Lameter | 293b6a4 | 2014-04-07 15:39:43 -0700 | [diff] [blame] | 35 | raw_cpu_inc(vm_event_states.event[item]); |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 36 | } |
Christoph Lameter | f6ac235 | 2006-06-30 01:55:32 -0700 | [diff] [blame] | 37 | |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 38 | static inline void count_vm_event(enum vm_event_item item) |
| 39 | { |
Rusty Russell | dd17c8f | 2009-10-29 22:34:15 +0900 | [diff] [blame] | 40 | this_cpu_inc(vm_event_states.event[item]); |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 41 | } |
Christoph Lameter | f6ac235 | 2006-06-30 01:55:32 -0700 | [diff] [blame] | 42 | |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 43 | static inline void __count_vm_events(enum vm_event_item item, long delta) |
| 44 | { |
Christoph Lameter | 293b6a4 | 2014-04-07 15:39:43 -0700 | [diff] [blame] | 45 | raw_cpu_add(vm_event_states.event[item], delta); |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 46 | } |
Christoph Lameter | f6ac235 | 2006-06-30 01:55:32 -0700 | [diff] [blame] | 47 | |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 48 | static inline void count_vm_events(enum vm_event_item item, long delta) |
| 49 | { |
Rusty Russell | dd17c8f | 2009-10-29 22:34:15 +0900 | [diff] [blame] | 50 | this_cpu_add(vm_event_states.event[item], delta); |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 51 | } |
Christoph Lameter | f6ac235 | 2006-06-30 01:55:32 -0700 | [diff] [blame] | 52 | |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 53 | extern void all_vm_events(unsigned long *); |
Yijing Wang | f1cb087 | 2013-04-29 15:08:14 -0700 | [diff] [blame] | 54 | |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 55 | extern void vm_events_fold_cpu(int cpu); |
Christoph Lameter | f6ac235 | 2006-06-30 01:55:32 -0700 | [diff] [blame] | 56 | |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 57 | #else |
Christoph Lameter | f6ac235 | 2006-06-30 01:55:32 -0700 | [diff] [blame] | 58 | |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 59 | /* Disable counters */ |
Andrew Morton | 780a065 | 2007-02-10 01:44:41 -0800 | [diff] [blame] | 60 | static inline void count_vm_event(enum vm_event_item item) |
| 61 | { |
| 62 | } |
| 63 | static inline void count_vm_events(enum vm_event_item item, long delta) |
| 64 | { |
| 65 | } |
| 66 | static inline void __count_vm_event(enum vm_event_item item) |
| 67 | { |
| 68 | } |
| 69 | static inline void __count_vm_events(enum vm_event_item item, long delta) |
| 70 | { |
| 71 | } |
| 72 | static inline void all_vm_events(unsigned long *ret) |
| 73 | { |
| 74 | } |
| 75 | static inline void vm_events_fold_cpu(int cpu) |
| 76 | { |
| 77 | } |
Christoph Lameter | f6ac235 | 2006-06-30 01:55:32 -0700 | [diff] [blame] | 78 | |
Christoph Lameter | f8891e5 | 2006-06-30 01:55:45 -0700 | [diff] [blame] | 79 | #endif /* CONFIG_VM_EVENT_COUNTERS */ |
| 80 | |
Mel Gorman | 03c5a6e | 2012-11-02 14:52:48 +0000 | [diff] [blame] | 81 | #ifdef CONFIG_NUMA_BALANCING |
| 82 | #define count_vm_numa_event(x) count_vm_event(x) |
| 83 | #define count_vm_numa_events(x, y) count_vm_events(x, y) |
| 84 | #else |
| 85 | #define count_vm_numa_event(x) do {} while (0) |
Mel Gorman | 3c0ff46 | 2013-02-22 16:34:29 -0800 | [diff] [blame] | 86 | #define count_vm_numa_events(x, y) do { (void)(y); } while (0) |
Mel Gorman | 03c5a6e | 2012-11-02 14:52:48 +0000 | [diff] [blame] | 87 | #endif /* CONFIG_NUMA_BALANCING */ |
| 88 | |
Mel Gorman | ec65993 | 2014-01-21 14:33:16 -0800 | [diff] [blame] | 89 | #ifdef CONFIG_DEBUG_TLBFLUSH |
| 90 | #define count_vm_tlb_event(x) count_vm_event(x) |
| 91 | #define count_vm_tlb_events(x, y) count_vm_events(x, y) |
| 92 | #else |
| 93 | #define count_vm_tlb_event(x) do {} while (0) |
| 94 | #define count_vm_tlb_events(x, y) do { (void)(y); } while (0) |
| 95 | #endif |
| 96 | |
Davidlohr Bueso | 4f11514 | 2014-06-04 16:06:46 -0700 | [diff] [blame] | 97 | #ifdef CONFIG_DEBUG_VM_VMACACHE |
| 98 | #define count_vm_vmacache_event(x) count_vm_event(x) |
| 99 | #else |
| 100 | #define count_vm_vmacache_event(x) do {} while (0) |
| 101 | #endif |
| 102 | |
Mel Gorman | 16709d1 | 2016-07-28 15:46:56 -0700 | [diff] [blame] | 103 | #define __count_zid_vm_events(item, zid, delta) \ |
| 104 | __count_vm_events(item##_NORMAL - ZONE_NORMAL + zid, delta) |
Christoph Lameter | f6ac235 | 2006-06-30 01:55:32 -0700 | [diff] [blame] | 105 | |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 106 | /* |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 107 | * Zone and node-based page accounting with per cpu differentials. |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 108 | */ |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 109 | extern atomic_long_t vm_zone_stat[NR_VM_ZONE_STAT_ITEMS]; |
| 110 | extern atomic_long_t vm_node_stat[NR_VM_NODE_STAT_ITEMS]; |
Christoph Lameter | f6ac235 | 2006-06-30 01:55:32 -0700 | [diff] [blame] | 111 | |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 112 | static inline void zone_page_state_add(long x, struct zone *zone, |
| 113 | enum zone_stat_item item) |
| 114 | { |
| 115 | atomic_long_add(x, &zone->vm_stat[item]); |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 116 | atomic_long_add(x, &vm_zone_stat[item]); |
| 117 | } |
| 118 | |
| 119 | static inline void node_page_state_add(long x, struct pglist_data *pgdat, |
| 120 | enum node_stat_item item) |
| 121 | { |
| 122 | atomic_long_add(x, &pgdat->vm_stat[item]); |
| 123 | atomic_long_add(x, &vm_node_stat[item]); |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | static inline unsigned long global_page_state(enum zone_stat_item item) |
| 127 | { |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 128 | long x = atomic_long_read(&vm_zone_stat[item]); |
| 129 | #ifdef CONFIG_SMP |
| 130 | if (x < 0) |
| 131 | x = 0; |
| 132 | #endif |
| 133 | return x; |
| 134 | } |
| 135 | |
| 136 | static inline unsigned long global_node_page_state(enum node_stat_item item) |
| 137 | { |
| 138 | long x = atomic_long_read(&vm_node_stat[item]); |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 139 | #ifdef CONFIG_SMP |
| 140 | if (x < 0) |
| 141 | x = 0; |
| 142 | #endif |
| 143 | return x; |
| 144 | } |
| 145 | |
| 146 | static inline unsigned long zone_page_state(struct zone *zone, |
| 147 | enum zone_stat_item item) |
| 148 | { |
| 149 | long x = atomic_long_read(&zone->vm_stat[item]); |
| 150 | #ifdef CONFIG_SMP |
| 151 | if (x < 0) |
| 152 | x = 0; |
| 153 | #endif |
| 154 | return x; |
| 155 | } |
| 156 | |
Christoph Lameter | aa45484 | 2010-09-09 16:38:17 -0700 | [diff] [blame] | 157 | /* |
| 158 | * More accurate version that also considers the currently pending |
| 159 | * deltas. For that we need to loop over all cpus to find the current |
| 160 | * deltas. There is no synchronization so the result cannot be |
| 161 | * exactly accurate either. |
| 162 | */ |
| 163 | static inline unsigned long zone_page_state_snapshot(struct zone *zone, |
| 164 | enum zone_stat_item item) |
| 165 | { |
| 166 | long x = atomic_long_read(&zone->vm_stat[item]); |
| 167 | |
| 168 | #ifdef CONFIG_SMP |
| 169 | int cpu; |
| 170 | for_each_online_cpu(cpu) |
| 171 | x += per_cpu_ptr(zone->pageset, cpu)->vm_stat_diff[item]; |
| 172 | |
| 173 | if (x < 0) |
| 174 | x = 0; |
| 175 | #endif |
| 176 | return x; |
| 177 | } |
| 178 | |
Mel Gorman | 599d0c9 | 2016-07-28 15:45:31 -0700 | [diff] [blame] | 179 | static inline unsigned long node_page_state_snapshot(pg_data_t *pgdat, |
| 180 | enum node_stat_item item) |
| 181 | { |
| 182 | long x = atomic_long_read(&pgdat->vm_stat[item]); |
| 183 | |
| 184 | #ifdef CONFIG_SMP |
| 185 | int cpu; |
| 186 | for_each_online_cpu(cpu) |
| 187 | x += per_cpu_ptr(pgdat->per_cpu_nodestats, cpu)->vm_node_stat_diff[item]; |
| 188 | |
| 189 | if (x < 0) |
| 190 | x = 0; |
| 191 | #endif |
| 192 | return x; |
| 193 | } |
| 194 | |
| 195 | |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 196 | #ifdef CONFIG_NUMA |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 197 | extern unsigned long sum_zone_node_page_state(int node, |
| 198 | enum zone_stat_item item); |
| 199 | extern unsigned long node_page_state(struct pglist_data *pgdat, |
| 200 | enum node_stat_item item); |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 201 | #else |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 202 | #define sum_zone_node_page_state(node, item) global_page_state(item) |
| 203 | #define node_page_state(node, item) global_node_page_state(item) |
Christoph Lameter | ca889e6 | 2006-06-30 01:55:44 -0700 | [diff] [blame] | 204 | #endif /* CONFIG_NUMA */ |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 205 | |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 206 | #define add_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, __d) |
| 207 | #define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d)) |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 208 | #define add_node_page_state(__p, __i, __d) mod_node_page_state(__p, __i, __d) |
| 209 | #define sub_node_page_state(__p, __i, __d) mod_node_page_state(__p, __i, -(__d)) |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 210 | |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 211 | #ifdef CONFIG_SMP |
Heiko Carstens | 6cdb18a | 2015-12-29 14:54:32 -0800 | [diff] [blame] | 212 | void __mod_zone_page_state(struct zone *, enum zone_stat_item item, long); |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 213 | void __inc_zone_page_state(struct page *, enum zone_stat_item); |
| 214 | void __dec_zone_page_state(struct page *, enum zone_stat_item); |
| 215 | |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 216 | void __mod_node_page_state(struct pglist_data *, enum node_stat_item item, long); |
| 217 | void __inc_node_page_state(struct page *, enum node_stat_item); |
| 218 | void __dec_node_page_state(struct page *, enum node_stat_item); |
| 219 | |
Heiko Carstens | 6cdb18a | 2015-12-29 14:54:32 -0800 | [diff] [blame] | 220 | void mod_zone_page_state(struct zone *, enum zone_stat_item, long); |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 221 | void inc_zone_page_state(struct page *, enum zone_stat_item); |
| 222 | void dec_zone_page_state(struct page *, enum zone_stat_item); |
| 223 | |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 224 | void mod_node_page_state(struct pglist_data *, enum node_stat_item, long); |
| 225 | void inc_node_page_state(struct page *, enum node_stat_item); |
| 226 | void dec_node_page_state(struct page *, enum node_stat_item); |
| 227 | |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 228 | extern void inc_node_state(struct pglist_data *, enum node_stat_item); |
Christoph Lameter | c878538 | 2007-02-10 01:43:01 -0800 | [diff] [blame] | 229 | extern void __inc_zone_state(struct zone *, enum zone_stat_item); |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 230 | extern void __inc_node_state(struct pglist_data *, enum node_stat_item); |
Christoph Lameter | c878538 | 2007-02-10 01:43:01 -0800 | [diff] [blame] | 231 | extern void dec_zone_state(struct zone *, enum zone_stat_item); |
| 232 | extern void __dec_zone_state(struct zone *, enum zone_stat_item); |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 233 | extern void __dec_node_state(struct pglist_data *, enum node_stat_item); |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 234 | |
Christoph Lameter | 0eb77e9 | 2016-01-14 15:21:40 -0800 | [diff] [blame] | 235 | void quiet_vmstat(void); |
Christoph Lameter | 2bb921e | 2013-09-11 14:21:30 -0700 | [diff] [blame] | 236 | void cpu_vm_stats_fold(int cpu); |
KOSAKI Motohiro | a6cccdc | 2011-05-24 17:11:33 -0700 | [diff] [blame] | 237 | void refresh_zone_stat_thresholds(void); |
Mel Gorman | b44129b | 2011-01-13 15:45:43 -0800 | [diff] [blame] | 238 | |
Hugh Dickins | 52b6f46 | 2016-05-19 17:12:50 -0700 | [diff] [blame] | 239 | struct ctl_table; |
| 240 | int vmstat_refresh(struct ctl_table *, int write, |
| 241 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| 242 | |
Minchan Kim | 5a88381 | 2012-10-08 16:33:39 -0700 | [diff] [blame] | 243 | void drain_zonestat(struct zone *zone, struct per_cpu_pageset *); |
| 244 | |
Mel Gorman | b44129b | 2011-01-13 15:45:43 -0800 | [diff] [blame] | 245 | int calculate_pressure_threshold(struct zone *zone); |
| 246 | int calculate_normal_threshold(struct zone *zone); |
| 247 | void set_pgdat_percpu_threshold(pg_data_t *pgdat, |
| 248 | int (*calculate_pressure)(struct zone *)); |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 249 | #else /* CONFIG_SMP */ |
| 250 | |
| 251 | /* |
| 252 | * We do not maintain differentials in a single processor configuration. |
| 253 | * The functions directly modify the zone and global counters. |
| 254 | */ |
| 255 | static inline void __mod_zone_page_state(struct zone *zone, |
Heiko Carstens | 6cdb18a | 2015-12-29 14:54:32 -0800 | [diff] [blame] | 256 | enum zone_stat_item item, long delta) |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 257 | { |
| 258 | zone_page_state_add(delta, zone, item); |
| 259 | } |
| 260 | |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 261 | static inline void __mod_node_page_state(struct pglist_data *pgdat, |
| 262 | enum node_stat_item item, int delta) |
| 263 | { |
| 264 | node_page_state_add(delta, pgdat, item); |
| 265 | } |
| 266 | |
Christoph Lameter | 7f4599e | 2006-07-10 04:44:30 -0700 | [diff] [blame] | 267 | static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item) |
| 268 | { |
| 269 | atomic_long_inc(&zone->vm_stat[item]); |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 270 | atomic_long_inc(&vm_zone_stat[item]); |
| 271 | } |
| 272 | |
| 273 | static inline void __inc_node_state(struct pglist_data *pgdat, enum node_stat_item item) |
| 274 | { |
| 275 | atomic_long_inc(&pgdat->vm_stat[item]); |
| 276 | atomic_long_inc(&vm_node_stat[item]); |
Christoph Lameter | 7f4599e | 2006-07-10 04:44:30 -0700 | [diff] [blame] | 277 | } |
| 278 | |
Christoph Lameter | c878538 | 2007-02-10 01:43:01 -0800 | [diff] [blame] | 279 | static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item) |
| 280 | { |
| 281 | atomic_long_dec(&zone->vm_stat[item]); |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 282 | atomic_long_dec(&vm_zone_stat[item]); |
| 283 | } |
| 284 | |
| 285 | static inline void __dec_node_state(struct pglist_data *pgdat, enum node_stat_item item) |
| 286 | { |
| 287 | atomic_long_dec(&pgdat->vm_stat[item]); |
| 288 | atomic_long_dec(&vm_node_stat[item]); |
Christoph Lameter | c878538 | 2007-02-10 01:43:01 -0800 | [diff] [blame] | 289 | } |
| 290 | |
Johannes Weiner | 6a3ed21 | 2014-04-03 14:47:34 -0700 | [diff] [blame] | 291 | static inline void __inc_zone_page_state(struct page *page, |
| 292 | enum zone_stat_item item) |
| 293 | { |
| 294 | __inc_zone_state(page_zone(page), item); |
| 295 | } |
| 296 | |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 297 | static inline void __inc_node_page_state(struct page *page, |
| 298 | enum node_stat_item item) |
| 299 | { |
| 300 | __inc_node_state(page_pgdat(page), item); |
| 301 | } |
| 302 | |
| 303 | |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 304 | static inline void __dec_zone_page_state(struct page *page, |
| 305 | enum zone_stat_item item) |
| 306 | { |
Uwe Kleine-König | 57ce36f | 2008-02-25 16:45:03 +0100 | [diff] [blame] | 307 | __dec_zone_state(page_zone(page), item); |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 308 | } |
| 309 | |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 310 | static inline void __dec_node_page_state(struct page *page, |
| 311 | enum node_stat_item item) |
| 312 | { |
| 313 | __dec_node_state(page_pgdat(page), item); |
| 314 | } |
| 315 | |
| 316 | |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 317 | /* |
| 318 | * We only use atomic operations to update counters. So there is no need to |
| 319 | * disable interrupts. |
| 320 | */ |
| 321 | #define inc_zone_page_state __inc_zone_page_state |
| 322 | #define dec_zone_page_state __dec_zone_page_state |
| 323 | #define mod_zone_page_state __mod_zone_page_state |
| 324 | |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 325 | #define inc_node_page_state __inc_node_page_state |
| 326 | #define dec_node_page_state __dec_node_page_state |
| 327 | #define mod_node_page_state __mod_node_page_state |
| 328 | |
Johannes Weiner | 6a3ed21 | 2014-04-03 14:47:34 -0700 | [diff] [blame] | 329 | #define inc_zone_state __inc_zone_state |
Mel Gorman | 75ef718 | 2016-07-28 15:45:24 -0700 | [diff] [blame] | 330 | #define inc_node_state __inc_node_state |
Johannes Weiner | 6a3ed21 | 2014-04-03 14:47:34 -0700 | [diff] [blame] | 331 | #define dec_zone_state __dec_zone_state |
| 332 | |
Mel Gorman | b44129b | 2011-01-13 15:45:43 -0800 | [diff] [blame] | 333 | #define set_pgdat_percpu_threshold(pgdat, callback) { } |
Mel Gorman | 88f5acf | 2011-01-13 15:45:41 -0800 | [diff] [blame] | 334 | |
KOSAKI Motohiro | a6cccdc | 2011-05-24 17:11:33 -0700 | [diff] [blame] | 335 | static inline void refresh_zone_stat_thresholds(void) { } |
Christoph Lameter | 2bb921e | 2013-09-11 14:21:30 -0700 | [diff] [blame] | 336 | static inline void cpu_vm_stats_fold(int cpu) { } |
Christoph Lameter | 0eb77e9 | 2016-01-14 15:21:40 -0800 | [diff] [blame] | 337 | static inline void quiet_vmstat(void) { } |
KOSAKI Motohiro | a6cccdc | 2011-05-24 17:11:33 -0700 | [diff] [blame] | 338 | |
Minchan Kim | 5a88381 | 2012-10-08 16:33:39 -0700 | [diff] [blame] | 339 | static inline void drain_zonestat(struct zone *zone, |
| 340 | struct per_cpu_pageset *pset) { } |
KOSAKI Motohiro | fa25c50 | 2011-05-24 17:11:28 -0700 | [diff] [blame] | 341 | #endif /* CONFIG_SMP */ |
| 342 | |
Bartlomiej Zolnierkiewicz | d1ce749 | 2012-10-08 16:32:02 -0700 | [diff] [blame] | 343 | static inline void __mod_zone_freepage_state(struct zone *zone, int nr_pages, |
| 344 | int migratetype) |
| 345 | { |
| 346 | __mod_zone_page_state(zone, NR_FREE_PAGES, nr_pages); |
| 347 | if (is_migrate_cma(migratetype)) |
| 348 | __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, nr_pages); |
| 349 | } |
| 350 | |
KOSAKI Motohiro | fa25c50 | 2011-05-24 17:11:28 -0700 | [diff] [blame] | 351 | extern const char * const vmstat_text[]; |
Christoph Lameter | 2244b95 | 2006-06-30 01:55:33 -0700 | [diff] [blame] | 352 | |
| 353 | #endif /* _LINUX_VMSTAT_H */ |