From: Nick Piggin <nickpiggin@yahoo.com.au>

These are some values I just found from thin-air that should hopefully make
ia64 work after the latest sched patches.

Though it did look like there may have been some problems with the old
values, which I tried to fix up too:

- SD_ALLNODES_INIT had .balance_interval set a specific way - this field
  is internal to the scheduler and will end up sitting between min_interval
  and max_interval and not do what was intended, so tweak max_interval
  instead.

- SD_ALLNODES_INIT had SD_BALANCE_EXEC set.  The scheduler doesn't cope
  _really_ well with doing balance-on-exec over the top level of a
  multi-level NUMA setup like this.  It will tend to fill up the first CPUs
  in each high level group (cluster of 6 nodes) rather than spreading the
  load on a per-node basis.  This could be improved if we really need it,
  but for now remove the flag from the top level.

- Increase SD_NODES_PER_DOMAIN in the low level NUMA domain so we still
  push tasks out a reasonable distance.  Set SD_BALANCE_FORK in this domain
  too.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/ia64/kernel/domain.c   |    2 -
 25-akpm/include/asm-ia64/topology.h |   62 +++++++++++++++++++++++++++---------
 2 files changed, 49 insertions(+), 15 deletions(-)

diff -puN arch/ia64/kernel/domain.c~random-ia64-sched-domains-values arch/ia64/kernel/domain.c
--- 25/arch/ia64/kernel/domain.c~random-ia64-sched-domains-values	2005-02-25 00:30:26.000000000 -0800
+++ 25-akpm/arch/ia64/kernel/domain.c	2005-02-25 00:30:26.000000000 -0800
@@ -14,7 +14,7 @@
 #include <linux/topology.h>
 #include <linux/nodemask.h>
 
-#define SD_NODES_PER_DOMAIN 6
+#define SD_NODES_PER_DOMAIN 16
 
 #ifdef CONFIG_NUMA
 /**
diff -puN include/asm-ia64/topology.h~random-ia64-sched-domains-values include/asm-ia64/topology.h
--- 25/include/asm-ia64/topology.h~random-ia64-sched-domains-values	2005-02-25 00:30:26.000000000 -0800
+++ 25-akpm/include/asm-ia64/topology.h	2005-02-25 00:30:26.000000000 -0800
@@ -42,25 +42,55 @@
 
 void build_cpu_to_node_map(void);
 
+#define SD_CPU_INIT (struct sched_domain) {		\
+	.span			= CPU_MASK_NONE,	\
+	.parent			= NULL,			\
+	.groups			= NULL,			\
+	.min_interval		= 1,			\
+	.max_interval		= 4,			\
+	.busy_factor		= 64,			\
+	.imbalance_pct		= 125,			\
+	.cache_hot_time		= (10*1000000),		\
+	.cache_nice_tries	= 2,			\
+	.per_cpu_gain		= 100,			\
+	.cache_nice_tries	= 2,			\
+	.busy_idx		= 2,			\
+	.idle_idx		= 1,			\
+	.newidle_idx		= 2,			\
+	.wake_idx		= 1,			\
+	.forkexec_idx		= 1,			\
+	.flags			= SD_LOAD_BALANCE	\
+				| SD_BALANCE_NEWIDLE	\
+				| SD_BALANCE_EXEC	\
+				| SD_WAKE_AFFINE,	\
+	.last_balance		= jiffies,		\
+	.balance_interval	= 1,			\
+	.nr_balance_failed	= 0,			\
+}
+
 /* sched_domains SD_NODE_INIT for IA64 NUMA machines */
 #define SD_NODE_INIT (struct sched_domain) {		\
 	.span			= CPU_MASK_NONE,	\
 	.parent			= NULL,			\
 	.groups			= NULL,			\
-	.min_interval		= 80,			\
-	.max_interval		= 320,			\
-	.busy_factor		= 320,			\
+	.min_interval		= 8,			\
+	.max_interval		= 8*(min(num_online_cpus(), 32)), \
+	.busy_factor		= 64,			\
 	.imbalance_pct		= 125,			\
 	.cache_hot_time		= (10*1000000),		\
-	.cache_nice_tries	= 1,			\
+	.cache_nice_tries	= 2,			\
+	.busy_idx		= 3,			\
+	.idle_idx		= 2,			\
+	.newidle_idx		= 0, /* unused */	\
+	.wake_idx		= 1,			\
+	.forkexec_idx		= 1,			\
 	.per_cpu_gain		= 100,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_EXEC	\
-				| SD_BALANCE_NEWIDLE	\
-				| SD_WAKE_IDLE		\
+				| SD_BALANCE_FORK	\
 				| SD_WAKE_BALANCE,	\
 	.last_balance		= jiffies,		\
-	.balance_interval	= 1,			\
+	.balance_interval	= 64,			\
 	.nr_balance_failed	= 0,			\
 }
 
@@ -69,17 +99,21 @@ void build_cpu_to_node_map(void);
 	.span			= CPU_MASK_NONE,	\
 	.parent			= NULL,			\
 	.groups			= NULL,			\
-	.min_interval		= 80,			\
-	.max_interval		= 320,			\
-	.busy_factor		= 320,			\
-	.imbalance_pct		= 125,			\
+	.min_interval		= 64,			\
+	.max_interval		= 64*num_online_cpus(),	\
+	.busy_factor		= 128,			\
+	.imbalance_pct		= 133,			\
 	.cache_hot_time		= (10*1000000),		\
 	.cache_nice_tries	= 1,			\
+	.busy_idx		= 3,			\
+	.idle_idx		= 3,			\
+	.newidle_idx		= 0, /* unused */	\
+	.wake_idx		= 0, /* unused */	\
+	.forkexec_idx		= 0, /* unused */	\
 	.per_cpu_gain		= 100,			\
-	.flags			= SD_LOAD_BALANCE	\
-				| SD_BALANCE_EXEC,	\
+	.flags			= SD_LOAD_BALANCE,	\
 	.last_balance		= jiffies,		\
-	.balance_interval	= 100*(63+num_online_cpus())/64,   \
+	.balance_interval	= 64,			\
 	.nr_balance_failed	= 0,			\
 }
 
_