|
30 | 30 |
|
31 | 31 | #include "internal.h"
|
32 | 32 |
|
| 33 | +#define NUMA_STATS_THRESHOLD (U16_MAX - 2) |
| 34 | + |
33 | 35 | #ifdef CONFIG_VM_EVENT_COUNTERS
|
34 | 36 | DEFINE_PER_CPU(struct vm_event_state, vm_event_states) = {{0}};
|
35 | 37 | EXPORT_PER_CPU_SYMBOL(vm_event_states);
|
@@ -194,10 +196,7 @@ void refresh_zone_stat_thresholds(void)
|
194 | 196 |
|
195 | 197 | per_cpu_ptr(zone->pageset, cpu)->stat_threshold
|
196 | 198 | = threshold;
|
197 |
| -#ifdef CONFIG_NUMA |
198 |
| - per_cpu_ptr(zone->pageset, cpu)->numa_stat_threshold |
199 |
| - = threshold; |
200 |
| -#endif |
| 199 | + |
201 | 200 | /* Base nodestat threshold on the largest populated zone. */
|
202 | 201 | pgdat_threshold = per_cpu_ptr(pgdat->per_cpu_nodestats, cpu)->stat_threshold;
|
203 | 202 | per_cpu_ptr(pgdat->per_cpu_nodestats, cpu)->stat_threshold
|
@@ -231,14 +230,9 @@ void set_pgdat_percpu_threshold(pg_data_t *pgdat,
|
231 | 230 | continue;
|
232 | 231 |
|
233 | 232 | threshold = (*calculate_pressure)(zone);
|
234 |
| - for_each_online_cpu(cpu) { |
| 233 | + for_each_online_cpu(cpu) |
235 | 234 | per_cpu_ptr(zone->pageset, cpu)->stat_threshold
|
236 | 235 | = threshold;
|
237 |
| -#ifdef CONFIG_NUMA |
238 |
| - per_cpu_ptr(zone->pageset, cpu)->numa_stat_threshold |
239 |
| - = threshold; |
240 |
| -#endif |
241 |
| - } |
242 | 236 | }
|
243 | 237 | }
|
244 | 238 |
|
@@ -874,16 +868,14 @@ void __inc_numa_state(struct zone *zone,
|
874 | 868 | enum numa_stat_item item)
|
875 | 869 | {
|
876 | 870 | struct per_cpu_pageset __percpu *pcp = zone->pageset;
|
877 |
| - s8 __percpu *p = pcp->vm_numa_stat_diff + item; |
878 |
| - s8 v, t; |
| 871 | + u16 __percpu *p = pcp->vm_numa_stat_diff + item; |
| 872 | + u16 v; |
879 | 873 |
|
880 | 874 | v = __this_cpu_inc_return(*p);
|
881 |
| - t = __this_cpu_read(pcp->numa_stat_threshold); |
882 |
| - if (unlikely(v > t)) { |
883 |
| - s8 overstep = t >> 1; |
884 | 875 |
|
885 |
| - zone_numa_state_add(v + overstep, zone, item); |
886 |
| - __this_cpu_write(*p, -overstep); |
| 876 | + if (unlikely(v > NUMA_STATS_THRESHOLD)) { |
| 877 | + zone_numa_state_add(v, zone, item); |
| 878 | + __this_cpu_write(*p, 0); |
887 | 879 | }
|
888 | 880 | }
|
889 | 881 |
|
@@ -1798,7 +1790,7 @@ static bool need_update(int cpu)
|
1798 | 1790 |
|
1799 | 1791 | BUILD_BUG_ON(sizeof(p->vm_stat_diff[0]) != 1);
|
1800 | 1792 | #ifdef CONFIG_NUMA
|
1801 |
| - BUILD_BUG_ON(sizeof(p->vm_numa_stat_diff[0]) != 1); |
| 1793 | + BUILD_BUG_ON(sizeof(p->vm_numa_stat_diff[0]) != 2); |
1802 | 1794 | #endif
|
1803 | 1795 | /*
|
1804 | 1796 | * The fast way of checking if there are any vmstat diffs.
|
|
0 commit comments