[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-yhxhkcnevwerp7qzejirdmgv@git.kernel.org>
Date: Sat, 19 May 2012 04:33:40 -0700
From: tip-bot for Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: linux-tip-commits@...r.kernel.org
Cc: mingo@...nel.org, torvalds@...ux-foundation.org,
a.p.zijlstra@...llo.nl, cl@...ux.com, riel@...hat.com,
akpm@...ux-foundation.org, aarcange@...hat.com,
suresh.b.siddha@...el.com, tglx@...utronix.de, hpa@...or.com,
linux-kernel@...r.kernel.org, pjt@...gle.com,
bharata.rao@...il.com, Lee.Schermerhorn@...com, danms@...ibm.com,
mingo@...e.hu
Subject: [tip:sched/numa] sched/numa: Only migrate long-running entities
Commit-ID: ac733ee784e3f7a3f3efa3377ecdd4b8237a51cd
Gitweb: http://git.kernel.org/tip/ac733ee784e3f7a3f3efa3377ecdd4b8237a51cd
Author: Peter Zijlstra <a.p.zijlstra@...llo.nl>
AuthorDate: Fri, 9 Mar 2012 11:52:14 +0100
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Sat, 19 May 2012 12:55:25 +0200
sched/numa: Only migrate long-running entities
It doesn't make much sense to memory migrate short running things.
Suggested-by: Ingo Molnar <mingo@...e.hu>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Suresh Siddha <suresh.b.siddha@...el.com>
Cc: Paul Turner <pjt@...gle.com>
Cc: Dan Smith <danms@...ibm.com>
Cc: Bharata B Rao <bharata.rao@...il.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@...com>
Cc: Christoph Lameter <cl@...ux.com>
Cc: Rik van Riel <riel@...hat.com>
Cc: Andrea Arcangeli <aarcange@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Link: http://lkml.kernel.org/n/tip-yhxhkcnevwerp7qzejirdmgv@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
kernel/sched/numa.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/kernel/sched/numa.c b/kernel/sched/numa.c
index a23a66c..cfa49b7 100644
--- a/kernel/sched/numa.c
+++ b/kernel/sched/numa.c
@@ -27,6 +27,8 @@ struct numa_ops {
void (*mem_migrate)(struct numa_entity *ne, int node);
void (*cpu_migrate)(struct numa_entity *ne, int node);
+ u64 (*cpu_runtime)(struct numa_entity *ne);
+
bool (*tryget)(struct numa_entity *ne);
void (*put)(struct numa_entity *ne);
};
@@ -208,6 +210,21 @@ static void process_mem_migrate(struct numa_entity *ne, int node)
lazy_migrate_process(ne_mm(ne), node);
}
+static u64 process_cpu_runtime(struct numa_entity *ne)
+{
+ struct task_struct *p, *t;
+ u64 runtime = 0;
+
+ rcu_read_lock();
+ t = p = ne_owner(ne);
+ if (p) do {
+ runtime += t->se.sum_exec_runtime; // @#$#@ 32bit
+ } while ((t = next_thread(t)) != p);
+ rcu_read_unlock();
+
+ return runtime;
+}
+
static bool process_tryget(struct numa_entity *ne)
{
/*
@@ -231,6 +248,8 @@ static const struct numa_ops process_numa_ops = {
.mem_migrate = process_mem_migrate,
.cpu_migrate = process_cpu_migrate,
+ .cpu_runtime = process_cpu_runtime,
+
.tryget = process_tryget,
.put = process_put,
};
@@ -621,6 +640,14 @@ static bool can_move_ne(struct numa_entity *ne)
* XXX: consider mems_allowed, stinking cpusets has mems_allowed
* per task and it can actually differ over a whole process, la-la-la.
*/
+
+ /*
+ * Don't bother migrating memory if there's less than 1 second
+ * of runtime on the tasks.
+ */
+ if (ne->nops->cpu_runtime(ne) < NSEC_PER_SEC)
+ return false;
+
return true;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists