[RFC PATCH 03/11] sched: FAIR_SLEEPERS feature

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

[-- Attachment #1: sched-add-sleeper.patch --]
[-- Type: text/plain, Size: 1659 bytes --]

Add the fair sleeper feature which disables sleeper extra vruntime boost on
wakeup. This is makes the DYN_MIN_VRUNTIME feature behave better by keeping the
min_vruntime value somewhere between MIN_vruntime and max_vruntime (see
/proc/sched_debug output with CONFIG_SCHED_DEBUG=y).

Turning on this knob is typically bad for interactivity. This is why a later
patch introduces the "FAIR_SLEEPERS_INTERACTIVE" feature, which provides this
combination of features:

NO_FAIR_SLEEPERS
FAIR_SLEEPERS_INTERACTIVE

So that fair sleeper fairness is only given to interactive wakeup chains.

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

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
@@ -735,7 +735,7 @@ place_entity(struct cfs_rq *cfs_rq, stru
vruntime += sched_vslice(cfs_rq, se);

/* sleeps up to a single latency don't count. */
- if (!initial) {
+ if (sched_feat(FAIR_SLEEPERS) && !initial) {
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,6 +3,7 @@
* them to run sooner, but does not allow tons of sleepers to
* rip the spread apart.
*/
+SCHED_FEAT(FAIR_SLEEPERS, 1)
SCHED_FEAT(GENTLE_FAIR_SLEEPERS, 1)

/*