[RFC PATCH 11/11] sched: fair sleepers for timer and interactive

Mathieu Desnoyers
2010-08-26T18:14:56Z

[-- Attachment #1: sched-fair-sleeper-for-timer-and-interactive.patch --]
[-- Type: text/plain, Size: 1812 bytes --]

Add FAIR_SLEEPERS_TIMER and FAIR_SLEEPERS_INTERACTIVE tuning knobs.

Turning off FAIR_SLEEPERS and turning on FAIR_SLEEPERS_INTERACTIVE does a pretty
good job for interactivity.

Setting FAIR_SLEEPERS to off helps keeping the min_vruntime value somewhere
between MIN_vruntime and max_vruntime rather than somewhere at the right of all
running threads.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
kernel/sched_fair.c | 5 ++++-
kernel/sched_features.h | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6-lttng.git/kernel/sched_fair.c
===================================================================
--- linux-2.6-lttng.git.orig/kernel/sched_fair.c
+++ linux-2.6-lttng.git/kernel/sched_fair.c
@@ -748,7 +748,10 @@ place_entity(struct cfs_rq *cfs_rq, stru
vruntime += sched_vslice(cfs_rq, se);

/* sleeps up to a single latency don't count. */
- if (sched_feat(FAIR_SLEEPERS) && !initial) {
+ if (!initial
+ && (sched_feat(FAIR_SLEEPERS)
+ || (sched_feat(FAIR_SLEEPERS_TIMER) && se->timer)
+ || (sched_feat(FAIR_SLEEPERS_INTERACTIVE) && se->interactive))) {
unsigned long thresh = sysctl_sched_latency;

/*
Index: linux-2.6-lttng.git/kernel/sched_features.h
===================================================================
--- linux-2.6-lttng.git.orig/kernel/sched_features.h
+++ linux-2.6-lttng.git/kernel/sched_features.h
@@ -3,7 +3,9 @@
* them to run sooner, but does not allow tons of sleepers to
* rip the spread apart.
*/
-SCHED_FEAT(FAIR_SLEEPERS, 1)
+SCHED_FEAT(FAIR_SLEEPERS, 1) /* Apply to all wakeups */
+SCHED_FEAT(FAIR_SLEEPERS_INTERACTIVE, 0) /* Selects interactive wakeups */
+SCHED_FEAT(FAIR_SLEEPERS_TIMER, 0) /* Selects timer-driven wakeups */
SCHED_FEAT(GENTLE_FAIR_SLEEPERS, 1)

/*