mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
sched/numa: Update NUMA hinting faults once per scan
NUMA hinting fault counts and placement decisions are both recorded in the same array which distorts the samples in an unpredictable fashion. The values linearly accumulate during the scan and then decay creating a sawtooth-like pattern in the per-node counts. It also means that placement decisions are time sensitive. At best it means that it is very difficult to state that the buffer holds a decaying average of past faulting behaviour. At worst, it can confuse the load balancer if it sees one node with an artifically high count due to very recent faulting activity and may create a bouncing effect. This patch adds a second array. numa_faults stores the historical data which is used for placement decisions. numa_faults_buffer holds the fault activity during the current scan window. When the scan completes, numa_faults decays and the values from numa_faults_buffer are copied across. Signed-off-by: Mel Gorman <[email protected]> Reviewed-by: Rik van Riel <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Srikar Dronamraju <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
688b7585d1
commit
745d61476d
3 changed files with 27 additions and 3 deletions
|
|
@ -1636,6 +1636,7 @@ static void __sched_fork(struct task_struct *p)
|
|||
p->numa_preferred_nid = -1;
|
||||
p->numa_work.next = &p->numa_work;
|
||||
p->numa_faults = NULL;
|
||||
p->numa_faults_buffer = NULL;
|
||||
#endif /* CONFIG_NUMA_BALANCING */
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -892,8 +892,14 @@ static void task_numa_placement(struct task_struct *p)
|
|||
|
||||
/* Find the node with the highest number of faults */
|
||||
for_each_online_node(nid) {
|
||||
unsigned long faults = p->numa_faults[nid];
|
||||
unsigned long faults;
|
||||
|
||||
/* Decay existing window and copy faults since last scan */
|
||||
p->numa_faults[nid] >>= 1;
|
||||
p->numa_faults[nid] += p->numa_faults_buffer[nid];
|
||||
p->numa_faults_buffer[nid] = 0;
|
||||
|
||||
faults = p->numa_faults[nid];
|
||||
if (faults > max_faults) {
|
||||
max_faults = faults;
|
||||
max_nid = nid;
|
||||
|
|
@ -919,9 +925,13 @@ void task_numa_fault(int node, int pages, bool migrated)
|
|||
if (unlikely(!p->numa_faults)) {
|
||||
int size = sizeof(*p->numa_faults) * nr_node_ids;
|
||||
|
||||
p->numa_faults = kzalloc(size, GFP_KERNEL|__GFP_NOWARN);
|
||||
/* numa_faults and numa_faults_buffer share the allocation */
|
||||
p->numa_faults = kzalloc(size * 2, GFP_KERNEL|__GFP_NOWARN);
|
||||
if (!p->numa_faults)
|
||||
return;
|
||||
|
||||
BUG_ON(p->numa_faults_buffer);
|
||||
p->numa_faults_buffer = p->numa_faults + nr_node_ids;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -939,7 +949,7 @@ void task_numa_fault(int node, int pages, bool migrated)
|
|||
|
||||
task_numa_placement(p);
|
||||
|
||||
p->numa_faults[node] += pages;
|
||||
p->numa_faults_buffer[node] += pages;
|
||||
}
|
||||
|
||||
static void reset_ptenuma_scan(struct task_struct *p)
|
||||
|
|
|
|||
Loading…
Reference in a new issue