lkml.org 
[lkml]   [2011]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[patch 4/6] sched: ratelimit select_idle_sibling()for sync wakeups
From
Date

select_idle_sibling() injures synchromous loads horribly
on processors with L3 (ala westmere) when called at high
Frequency. Cut it off at 40 KHz (25usec event rate) when
waking sync, in lieu of an inter-domain cache penalty.

Signed-off-by: Mike Galbraith <efault@gmx.de>

---
kernel/sched_fair.c | 20 ++++++++++++++++++--
kernel/sched_features.h | 6 ++++++
2 files changed, 24 insertions(+), 2 deletions(-)

Index: linux-3.2.git/kernel/sched_fair.c
===================================================================
--- linux-3.2.git.orig/kernel/sched_fair.c
+++ linux-3.2.git/kernel/sched_fair.c
@@ -2264,6 +2264,21 @@ static inline struct sched_domain *highe
}

/*
+ * select_idle_sibling() injures synchromous loads horribly
+ * on processors with L3 (ala westmere) when called at high
+ * Frequency. Cut it off at 40 KHz (25usec event rate) when
+ * waking sync, in lieu of an inter-domain cache penalty.
+ */
+#define SIBLING_SYNC_CUTOFF_NS (NSEC_PER_SEC/40000UL)
+
+static int idle_sibling_limit(int target, int sync)
+{
+ if (!sync || !sched_feat(SIBLING_LIMIT_SYNC))
+ return 0;
+ return cpu_rq(target)->avg_event < SIBLING_SYNC_CUTOFF_NS;
+}
+
+/*
* Try and locate an idle CPU in the sched_domain.
*/
static int select_idle_sibling(struct task_struct *p, int target)
@@ -2400,9 +2415,10 @@ select_task_rq_fair(struct task_struct *

if (affine_sd) {
if (cpu == prev_cpu || wake_affine(affine_sd, p, sync))
- prev_cpu = cpu;
+ new_cpu = cpu;

- new_cpu = select_idle_sibling(p, prev_cpu);
+ if (!idle_sibling_limit(new_cpu, sync))
+ new_cpu = select_idle_sibling(p, new_cpu);
goto unlock;
}

Index: linux-3.2.git/kernel/sched_features.h
===================================================================
--- linux-3.2.git.orig/kernel/sched_features.h
+++ linux-3.2.git/kernel/sched_features.h
@@ -67,3 +67,9 @@ SCHED_FEAT(NONTASK_POWER, 1)
SCHED_FEAT(TTWU_QUEUE, 1)

SCHED_FEAT(FORCE_SD_OVERLAP, 0)
+
+/*
+ * Restrict the frequency at which select_idle_sibling() may be called
+ * for synchronous wakeups.
+ */
+SCHED_FEAT(SIBLING_LIMIT_SYNC, 1)



\
 
 \ /
  Last update: 2011-11-18 16:23    [W:0.155 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site