Re: [PATCH] sched, numa: migrates_degrades_locality()
From: Mel Gorman
Date: Wed Jul 31 2013 - 04:44:26 EST
On Thu, Jul 25, 2013 at 12:40:09PM +0200, Peter Zijlstra wrote:
>
> Subject: sched, numa: migrates_degrades_locality()
> From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Date: Mon Jul 22 14:02:54 CEST 2013
>
> It just makes heaps of sense; so add it and make both it and
> migrate_improve_locality() a sched_feat().
>
Ok. I'll be splitting this patch and merging part of it into "sched:
Favour moving tasks towards the preferred node" and keeping the
degrades_locality as a separate patch. I'm also not a fan of the
tunables names NUMA_FAULTS_UP and NUMA_FAULTS_DOWN because it is hard to
guess what they mean. NUMA_FAVOUR_HIGHER, NUMA_RESIST_LOWER?
Change to just the parent patch looks is as follows. task_faults() is
not introduced yet in the series which is why it is still missing.
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 78bfbea..5ea3afe 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3978,8 +3978,10 @@ static bool migrate_improves_locality(struct task_struct *p, struct lb_env *env)
{
int src_nid, dst_nid;
- if (!p->numa_faults || !(env->sd->flags & SD_NUMA))
+ if (!sched_feat(NUMA_FAVOUR_HIGHER || !p->numa_faults ||
+ !(env->sd->flags & SD_NUMA))) {
return false;
+ }
src_nid = cpu_to_node(env->src_cpu);
dst_nid = cpu_to_node(env->dst_cpu);
@@ -3988,7 +3990,7 @@ static bool migrate_improves_locality(struct task_struct *p, struct lb_env *env)
p->numa_migrate_seq >= sysctl_numa_balancing_settle_count)
return false;
- if (p->numa_preferred_nid == dst_nid)
+ if (p->numa_faults[dst_nid] > p->numa_faults[src_nid])
return true;
return false;
diff --git a/kernel/sched/features.h b/kernel/sched/features.h
index 99399f8..97a1136 100644
--- a/kernel/sched/features.h
+++ b/kernel/sched/features.h
@@ -69,4 +69,11 @@ SCHED_FEAT(LB_MIN, false)
#ifdef CONFIG_NUMA_BALANCING
SCHED_FEAT(NUMA, false)
SCHED_FEAT(NUMA_FORCE, false)
+
+/*
+ * NUMA_FAVOUR_HIGHER will favor moving tasks towards nodes where a
+ * higher number of hinting faults are recorded during active load
+ * balancing.
+ */
+SCHED_FEAT(NUMA_FAVOUR_HIGHER, true)
#endif
--
Mel Gorman
SUSE Labs
--
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/