[PATCH 43/43] sched: numa: Increase and decrease a tasks scanning period based on task fault statistics

From: Mel Gorman
Date: Fri Nov 16 2012 - 06:24:15 EST


Currently the rate of scanning for an address space is controlled by the
individual tasks. The next scan is determined by p->numa_scan_period
and slowly increases as NUMA faults are handled. This assumes there are
no phase changes.

Now that there is a policy in place that guesses if a task or process
is properly placed, use that information to grow/shrink the scanning
window on a per-task basis.

Signed-off-by: Mel Gorman <mgorman@xxxxxxx>
---
kernel/sched/fair.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 6d2ccd3..598f657 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1063,18 +1063,25 @@ static void task_numa_placement(struct task_struct *p)
}

/*
+ * If this NUMA node is the selected on based on task NUMA
+ * faults then increase the time before it scans again
+ */
+ if (task_selected_nid == this_nid)
+ p->numa_scan_period = min(sysctl_balance_numa_scan_period_max,
+ p->numa_scan_period * 2);
+
+ /*
* If this NUMA node is the selected one based on process
* memory and task NUMA faults then set the home node.
* There should be no need to requeue the task.
*/
if (task_selected_nid == this_nid && mm_selected_nid == this_nid) {
- p->numa_scan_period = min(sysctl_balance_numa_scan_period_max,
- p->numa_scan_period * 2);
p->home_node = this_nid;
return;
}

- p->numa_scan_period = sysctl_balance_numa_scan_period_min;
+ p->numa_scan_period = max(sysctl_balance_numa_scan_period_min,
+ p->numa_scan_period / 2);
task_numa_find_placement(p);
}

@@ -1110,15 +1117,6 @@ void task_numa_fault(int node, int pages)
p->mm->mm_balancenuma->mm_numa_fault_tot++;
p->mm->mm_balancenuma->mm_numa_fault[node]++;

- /*
- * Assume that as faults occur that pages are getting properly placed
- * and fewer NUMA hints are required. Note that this is a big
- * assumption, it assumes processes reach a steady steady with no
- * further phase changes.
- */
- p->numa_scan_period = min(sysctl_balance_numa_scan_period_max,
- p->numa_scan_period + jiffies_to_msecs(2));
-
task_numa_placement(p);
}

--
1.7.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/