]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sched: Implement NUMA scanning backoff
authorIngo Molnar <mingo@kernel.org>
Wed, 14 Nov 2012 11:18:29 +0000 (12:18 +0100)
committerIngo Molnar <mingo@kernel.org>
Mon, 19 Nov 2012 13:49:44 +0000 (14:49 +0100)
Back off slowly from scanning, up to sysctl_sched_numa_scan_period_max
(1.6 seconds). Scan faster again if we were forced to switch to
another node.

This makes sure that workload in equilibrium don't get scanned as often
as workloads that are still converging.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/core.c
kernel/sched/fair.c

index af0602fc70d7ec543787c680603739ee74b96bfa..ec3cc741a0b78896467421d6ca239a27587595c4 100644 (file)
@@ -6024,6 +6024,12 @@ void sched_setnuma(struct task_struct *p, int node, int shared)
        if (on_rq)
                enqueue_task(rq, p, 0);
        task_rq_unlock(rq, p, &flags);
+
+       /*
+        * Reset the scanning period. If the task converges
+        * on this node then we'll back off again:
+        */
+       p->numa_scan_period = sysctl_sched_numa_scan_period_min;
 }
 
 #endif /* CONFIG_NUMA_BALANCING */
index 8f0e6ba6bfceafdd4304f50ab9721c402c140004..59fea2ec21e3fcb54c725a494c61ae629f0f2d8a 100644 (file)
@@ -865,8 +865,10 @@ static void task_numa_placement(struct task_struct *p)
                }
        }
 
-       if (max_node != p->numa_max_node)
+       if (max_node != p->numa_max_node) {
                sched_setnuma(p, max_node, task_numa_shared(p));
+               goto out_backoff;
+       }
 
        p->numa_migrate_seq++;
        if (sched_feat(NUMA_SETTLE) &&
@@ -882,7 +884,11 @@ static void task_numa_placement(struct task_struct *p)
        if (shared != task_numa_shared(p)) {
                sched_setnuma(p, p->numa_max_node, shared);
                p->numa_migrate_seq = 0;
+               goto out_backoff;
        }
+       return;
+out_backoff:
+       p->numa_scan_period = min(p->numa_scan_period * 2, sysctl_sched_numa_scan_period_max);
 }
 
 /*