diff options
Diffstat (limited to 'mm/vmstat.c')
-rw-r--r-- | mm/vmstat.c | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c index bc0f095791b4..751a65e00aac 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -83,7 +83,7 @@ EXPORT_SYMBOL(vm_stat); | |||
83 | 83 | ||
84 | #ifdef CONFIG_SMP | 84 | #ifdef CONFIG_SMP |
85 | 85 | ||
86 | static int calculate_pressure_threshold(struct zone *zone) | 86 | int calculate_pressure_threshold(struct zone *zone) |
87 | { | 87 | { |
88 | int threshold; | 88 | int threshold; |
89 | int watermark_distance; | 89 | int watermark_distance; |
@@ -107,7 +107,7 @@ static int calculate_pressure_threshold(struct zone *zone) | |||
107 | return threshold; | 107 | return threshold; |
108 | } | 108 | } |
109 | 109 | ||
110 | static int calculate_threshold(struct zone *zone) | 110 | int calculate_normal_threshold(struct zone *zone) |
111 | { | 111 | { |
112 | int threshold; | 112 | int threshold; |
113 | int mem; /* memory in 128 MB units */ | 113 | int mem; /* memory in 128 MB units */ |
@@ -166,7 +166,7 @@ static void refresh_zone_stat_thresholds(void) | |||
166 | for_each_populated_zone(zone) { | 166 | for_each_populated_zone(zone) { |
167 | unsigned long max_drift, tolerate_drift; | 167 | unsigned long max_drift, tolerate_drift; |
168 | 168 | ||
169 | threshold = calculate_threshold(zone); | 169 | threshold = calculate_normal_threshold(zone); |
170 | 170 | ||
171 | for_each_online_cpu(cpu) | 171 | for_each_online_cpu(cpu) |
172 | per_cpu_ptr(zone->pageset, cpu)->stat_threshold | 172 | per_cpu_ptr(zone->pageset, cpu)->stat_threshold |
@@ -185,46 +185,24 @@ static void refresh_zone_stat_thresholds(void) | |||
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | void reduce_pgdat_percpu_threshold(pg_data_t *pgdat) | 188 | void set_pgdat_percpu_threshold(pg_data_t *pgdat, |
189 | int (*calculate_pressure)(struct zone *)) | ||
189 | { | 190 | { |
190 | struct zone *zone; | 191 | struct zone *zone; |
191 | int cpu; | 192 | int cpu; |
192 | int threshold; | 193 | int threshold; |
193 | int i; | 194 | int i; |
194 | 195 | ||
195 | get_online_cpus(); | ||
196 | for (i = 0; i < pgdat->nr_zones; i++) { | ||
197 | zone = &pgdat->node_zones[i]; | ||
198 | if (!zone->percpu_drift_mark) | ||
199 | continue; | ||
200 | |||
201 | threshold = calculate_pressure_threshold(zone); | ||
202 | for_each_online_cpu(cpu) | ||
203 | per_cpu_ptr(zone->pageset, cpu)->stat_threshold | ||
204 | = threshold; | ||
205 | } | ||
206 | put_online_cpus(); | ||
207 | } | ||
208 | |||
209 | void restore_pgdat_percpu_threshold(pg_data_t *pgdat) | ||
210 | { | ||
211 | struct zone *zone; | ||
212 | int cpu; | ||
213 | int threshold; | ||
214 | int i; | ||
215 | |||
216 | get_online_cpus(); | ||
217 | for (i = 0; i < pgdat->nr_zones; i++) { | 196 | for (i = 0; i < pgdat->nr_zones; i++) { |
218 | zone = &pgdat->node_zones[i]; | 197 | zone = &pgdat->node_zones[i]; |
219 | if (!zone->percpu_drift_mark) | 198 | if (!zone->percpu_drift_mark) |
220 | continue; | 199 | continue; |
221 | 200 | ||
222 | threshold = calculate_threshold(zone); | 201 | threshold = (*calculate_pressure)(zone); |
223 | for_each_online_cpu(cpu) | 202 | for_each_possible_cpu(cpu) |
224 | per_cpu_ptr(zone->pageset, cpu)->stat_threshold | 203 | per_cpu_ptr(zone->pageset, cpu)->stat_threshold |
225 | = threshold; | 204 | = threshold; |
226 | } | 205 | } |
227 | put_online_cpus(); | ||
228 | } | 206 | } |
229 | 207 | ||
230 | /* | 208 | /* |