From: Paul Turner <pjt@google.com>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Ingo Molnar <mingo@elte.hu>, Mike Galbraith <efault@gmx.de>,
Nick Piggin <npiggin@kernel.dk>,
Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
Subject: [wake_afine fixes/improvements 3/3] sched: introduce sched_feat(NO_HOT_AFFINE)
Date: Fri, 14 Jan 2011 17:57:52 -0800 [thread overview]
Message-ID: <20110115015817.255632044@google.com> (raw)
In-Reply-To: 20110115015749.692623529@google.com
[-- Attachment #1: task_hot_lazy.patch --]
[-- Type: text/plain, Size: 2177 bytes --]
re-introduce the cache-cold requirement for affine wake-up balancing.
A much more aggressive migration cost (currently 0.5ms) appears to have tilted
the needle towards favouring not performing affine migrations for cache_hot
tasks.
Since the update_rq path is more expensive now (and the 'hot' window so small),
avoid hammering it in the common case where the (possibly slightly stale)
rq->clock_task value has already advanced enough to invalidate hot-ness.
Signed-off-by: Paul Turner <pjt@google.com>
---
kernel/sched_fair.c | 20 +++++++++++++++++++-
kernel/sched_features.h | 5 +++++
2 files changed, 24 insertions(+), 1 deletion(-)
Index: tip3/kernel/sched_fair.c
===================================================================
--- tip3.orig/kernel/sched_fair.c
+++ tip3/kernel/sched_fair.c
@@ -1376,6 +1376,23 @@ task_hot(struct task_struct *p, u64 now)
return delta < (s64)sysctl_sched_migration_cost;
}
+/*
+ * Since sched_migration_cost is (relatively) very small we only need to
+ * actually update the clock in the boundary case when determining whether a
+ * task is hot or not.
+ */
+static int task_hot_lazy(struct task_struct *p)
+{
+ struct rq *rq = task_rq(p);
+
+ if (!task_hot(p, rq->clock_task))
+ return 0;
+
+ update_rq_clock(rq);
+
+ return task_hot(p, rq->clock_task);
+}
+
#ifdef CONFIG_FAIR_GROUP_SCHED
/*
* effective_load() calculates the load change as seen from the root_task_group
@@ -1664,7 +1681,8 @@ select_task_rq_fair(struct rq *rq, struc
int sync = wake_flags & WF_SYNC;
if (sd_flag & SD_BALANCE_WAKE) {
- if (cpumask_test_cpu(cpu, &p->cpus_allowed))
+ if (cpumask_test_cpu(cpu, &p->cpus_allowed) &&
+ (!sched_feat(NO_HOT_AFFINE) || !task_hot_lazy(p)))
want_affine = 1;
new_cpu = prev_cpu;
}
Index: tip3/kernel/sched_features.h
===================================================================
--- tip3.orig/kernel/sched_features.h
+++ tip3/kernel/sched_features.h
@@ -64,3 +64,8 @@ SCHED_FEAT(OWNER_SPIN, 1)
* Decrement CPU power based on irq activity
*/
SCHED_FEAT(NONIRQ_POWER, 1)
+
+/*
+ * Don't consider cache-hot tasks for affine wakeups
+ */
+SCHED_FEAT(NO_HOT_AFFINE, 1)
next prev parent reply other threads:[~2011-01-15 2:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-15 1:57 [wake_afine fixes/improvements 0/3] Introduction Paul Turner
2011-01-15 1:57 ` [wake_afine fixes/improvements 1/3] sched: update effective_load() to use global share weights Paul Turner
2011-01-17 14:11 ` Peter Zijlstra
2011-01-17 14:20 ` Peter Zijlstra
2011-01-18 19:04 ` [tip:sched/urgent] sched: Update " tip-bot for Paul Turner
2011-01-15 1:57 ` [wake_afine fixes/improvements 2/3] sched: clean up task_hot() Paul Turner
2011-01-17 14:14 ` Peter Zijlstra
2011-01-18 21:52 ` Paul Turner
2011-01-15 1:57 ` Paul Turner [this message]
2011-01-15 14:29 ` [wake_afine fixes/improvements 0/3] Introduction Mike Galbraith
2011-01-15 19:29 ` Paul Turner
2011-01-15 21:34 ` Nick Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110115015817.255632044@google.com \
--to=pjt@google.com \
--cc=a.p.zijlstra@chello.nl \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=npiggin@kernel.dk \
--cc=vatsa@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox