From: Suresh Jayaraman <sjayaraman@suse.de>
Subject: Revert sched latency defaults
References: bnc#557307
Patch-mainline: Never

The upstream commit 172e082a91 re-tuned the sched latency defaults to better
suit desktop workloads. This hurt server workloads. So revert the latency
defaults to values similar to SLE11 GM to avoid several performance
regressions.

Re-enable FAIR_SLEEPERS. Various tests showed that enabling fair sleepers
did not show any degradation in performance. Also disable NORMALIZED_SLEEPER
which was actually a dead code earlier.

With these changes the only difference between upstream and SLE11-SP1 is
the increased latency defaults which makes sense for server workloads.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
---
 arch/Kconfig            |    4 ++++
 kernel/sched_fair.c     |   12 ++++++------
 kernel/sched_features.h |    4 ++++
 3 files changed, 14 insertions(+), 6 deletions(-)

Index: linux-3.0-tmp-jikos/arch/Kconfig
===================================================================
--- linux-3.0-tmp-jikos.orig/arch/Kconfig
+++ linux-3.0-tmp-jikos/arch/Kconfig
@@ -179,3 +179,7 @@ config HAVE_RCU_TABLE_FREE
 	bool
 
 source "kernel/gcov/Kconfig"
+
+config FAIR_SLEEPERS_ON_BY_DEFAULT
+	bool
+	default y if !S390
Index: linux-3.0-tmp-jikos/kernel/sched_fair.c
===================================================================
--- linux-3.0-tmp-jikos.orig/kernel/sched_fair.c
+++ linux-3.0-tmp-jikos/kernel/sched_fair.c
@@ -26,7 +26,7 @@
 
 /*
  * Targeted preemption latency for CPU-bound tasks:
- * (default: 6ms * (1 + ilog(ncpus)), units: nanoseconds)
+ * (default: 20ms * (1 + ilog(ncpus)), units: nanoseconds)
  *
  * NOTE: this latency value is not the same as the concept of
  * 'timeslice length' - timeslices in CFS are of variable length
@@ -36,7 +36,7 @@
  * (to see the precise effective timeslice length of your workload,
  *  run vmstat and monitor the context-switches (cs) field)
  */
-unsigned int sysctl_sched_latency = 6000000ULL;
+unsigned int sysctl_sched_latency = 20000000ULL;
 unsigned int normalized_sysctl_sched_latency = 6000000ULL;
 
 /*
@@ -53,9 +53,9 @@ enum sched_tunable_scaling sysctl_sched_
 
 /*
  * Minimal preemption granularity for CPU-bound tasks:
- * (default: 0.75 msec * (1 + ilog(ncpus)), units: nanoseconds)
+ * (default: 4 msec * (1 + ilog(ncpus)), units: nanoseconds)
  */
-unsigned int sysctl_sched_min_granularity = 750000ULL;
+unsigned int sysctl_sched_min_granularity = 4000000ULL;
 unsigned int normalized_sysctl_sched_min_granularity = 750000ULL;
 
 /*
@@ -71,13 +71,13 @@ unsigned int sysctl_sched_child_runs_fir
 
 /*
  * SCHED_OTHER wake-up granularity.
- * (default: 1 msec * (1 + ilog(ncpus)), units: nanoseconds)
+ * (default: 5 msec * (1 + ilog(ncpus)), units: nanoseconds)
  *
  * This option delays the preemption effects of decoupled workloads
  * and reduces their over-scheduling. Synchronous workloads will still
  * have immediate wakeup/sleep latencies.
  */
-unsigned int sysctl_sched_wakeup_granularity = 1000000UL;
+unsigned int sysctl_sched_wakeup_granularity = 5000000UL;
 unsigned int normalized_sysctl_sched_wakeup_granularity = 1000000UL;
 
 const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
Index: linux-3.0-tmp-jikos/kernel/sched_features.h
===================================================================
--- linux-3.0-tmp-jikos.orig/kernel/sched_features.h
+++ linux-3.0-tmp-jikos/kernel/sched_features.h
@@ -3,7 +3,11 @@
  * them to run sooner, but does not allow tons of sleepers to
  * rip the spread apart.
  */
+#ifdef CONFIG_FAIR_SLEEPERS_ON_BY_DEFAULT
 SCHED_FEAT(GENTLE_FAIR_SLEEPERS, 1)
+#else
+SCHED_FEAT(GENTLE_FAIR_SLEEPERS, 0)
+#endif
 
 /*
  * Place new tasks ahead so that they do not starve already running
