Patches contributed by Eötvös Lorand University


commit f9153ee6c71cb9ab38de3b8ed66b1c3fa27c3f7d
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Jul 16 09:46:30 2007 +0200

    [PATCH] sched: improve weight-array comments
    
    improve the comments around the wmult array (which controls the weight
    of niced tasks). Clarify that to achieve a 10% difference in CPU
    utilization, a weight multiplier of 1.25 has to be used.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/kernel/sched.c b/kernel/sched.c
index 3332bbb5d5cf..a7284bc79cdf 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -736,7 +736,9 @@ static void update_curr_load(struct rq *rq, u64 now)
  *
  * The "10% effect" is relative and cumulative: from _any_ nice level,
  * if you go up 1 level, it's -10% CPU usage, if you go down 1 level
- * it's +10% CPU usage.
+ * it's +10% CPU usage. (to achieve that we use a multiplier of 1.25.
+ * If a task goes up by ~10% and another task goes down by ~10% then
+ * the relative distance between them is ~25%.)
  */
 static const int prio_to_weight[40] = {
 /* -20 */ 88818, 71054, 56843, 45475, 36380, 29104, 23283, 18626, 14901, 11921,

commit 5926c50b83b626991c8c38efbca2020ee96b215f
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Jul 16 09:46:30 2007 +0200

    [PATCH] sched: remove dead code from task_stime()
    
    Alexey Dobriyan noticed that task_stime() contains a piece of dead code.
    (which is a remnant of earlier versions of this code) Remove that code.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/fs/proc/array.c b/fs/proc/array.c
index 98e78e2f18d6..c6977796fafd 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -332,7 +332,7 @@ static clock_t task_utime(struct task_struct *p)
 
 static clock_t task_stime(struct task_struct *p)
 {
-	clock_t stime = cputime_to_clock_t(p->stime);
+	clock_t stime;
 
 	/*
 	 * Use CFS's precise accounting. (we subtract utime from

commit e6c9116d1dc984cb7ecf1b0fe26ca4a8ab36bb57
Author: Ingo Molnar <mingo@elte.hu>
Date:   Sat Jul 14 18:50:15 2007 -0700

    [RFKILL]: fix net/rfkill/rfkill-input.c bug on 64-bit systems
    
    Subject: [patch] net/input: fix net/rfkill/rfkill-input.c bug on 64-bit systems
    
    this recent commit:
    
     commit cf4328cd949c2086091c62c5685f1580fe9b55e4
     Author: Ivo van Doorn <IvDoorn@gmail.com>
     Date:   Mon May 7 00:34:20 2007 -0700
    
         [NET]: rfkill: add support for input key to control wireless radio
    
    added this 64-bit bug:
    
            ....
            unsigned int flags;
    
            spin_lock_irqsave(&task->lock, flags);
            ....
    
    irq 'flags' must be unsigned long, not unsigned int. The -rt tree has
    strict checks about this on 64-bit so this triggered a build failure.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c
index e5c840c30284..230e35c59786 100644
--- a/net/rfkill/rfkill-input.c
+++ b/net/rfkill/rfkill-input.c
@@ -55,7 +55,7 @@ static void rfkill_task_handler(struct work_struct *work)
 
 static void rfkill_schedule_toggle(struct rfkill_task *task)
 {
-	unsigned int flags;
+	unsigned long flags;
 
 	spin_lock_irqsave(&task->lock, flags);
 

commit f787a50306680c187cf2896a8017937c1bf6dc7e
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Jul 11 21:21:47 2007 +0200

    [PATCH] sched: small topology.h cleanup
    
    trivial cleanup: LOCAL_DISTANCE and REMOTE_DISTANCE are only used in
    topology.h and inside an #ifndef section - limit their existence to
    that #ifndef.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/include/linux/topology.h b/include/linux/topology.h
index da6c39b2d051..d0890a7e5bab 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -50,10 +50,10 @@
 	for_each_online_node(node)						\
 		if (nr_cpus_node(node))
 
-#ifndef node_distance
 /* Conform to ACPI 2.0 SLIT distance definitions */
 #define LOCAL_DISTANCE		10
 #define REMOTE_DISTANCE		20
+#ifndef node_distance
 #define node_distance(from,to)	((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE)
 #endif
 #ifndef RECLAIM_DISTANCE

commit 4bd77321a833077c5c9ac7b9d284e261e4a8906e
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Jul 11 21:21:47 2007 +0200

    [PATCH] sched: fix show_task()/show_tasks() output
    
    fix show_task()/show_tasks() output:
    
    - there's no sibling info anymore
    
    - the fields were not aligned properly with the description
    
    - get rid of the lazy-TLB output: it's been quite some time since
      we last had a bug there, and when we had a bug it wasnt helped a
      bit by this debug output.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/kernel/sched.c b/kernel/sched.c
index 9088c2d97148..0559665a3a0b 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4647,14 +4647,14 @@ static void show_task(struct task_struct *p)
 	state = p->state ? __ffs(p->state) + 1 : 0;
 	printk("%-13.13s %c", p->comm,
 		state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?');
-#if (BITS_PER_LONG == 32)
+#if BITS_PER_LONG == 32
 	if (state == TASK_RUNNING)
-		printk(" running ");
+		printk(" running  ");
 	else
-		printk(" %08lX ", thread_saved_pc(p));
+		printk(" %08lx ", thread_saved_pc(p));
 #else
 	if (state == TASK_RUNNING)
-		printk("  running task   ");
+		printk("  running task    ");
 	else
 		printk(" %016lx ", thread_saved_pc(p));
 #endif
@@ -4666,11 +4666,7 @@ static void show_task(struct task_struct *p)
 		free = (unsigned long)n - (unsigned long)end_of_stack(p);
 	}
 #endif
-	printk("%5lu %5d %6d", free, p->pid, p->parent->pid);
-	if (!p->mm)
-		printk(" (L-TLB)\n");
-	else
-		printk(" (NOTLB)\n");
+	printk("%5lu %5d %6d\n", free, p->pid, p->parent->pid);
 
 	if (state != TASK_RUNNING)
 		show_stack(p, NULL);
@@ -4680,14 +4676,12 @@ void show_state_filter(unsigned long state_filter)
 {
 	struct task_struct *g, *p;
 
-#if (BITS_PER_LONG == 32)
-	printk("\n"
-	       "                         free                        sibling\n");
-	printk("  task             PC    stack   pid father child younger older\n");
+#if BITS_PER_LONG == 32
+	printk(KERN_INFO
+		"  task                PC stack   pid father\n");
 #else
-	printk("\n"
-	       "                                 free                        sibling\n");
-	printk("  task                 PC        stack   pid father child younger older\n");
+	printk(KERN_INFO
+		"  task                        PC stack   pid father\n");
 #endif
 	read_lock(&tasklist_lock);
 	do_each_thread(g, p) {

commit 45f384a64f0769bb9a3caf0516de88a629f48e61
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Jul 11 21:21:47 2007 +0200

    [PATCH] sched: remove stale version info from kernel/sched_debug.c
    
    kernel/sched_debug.c referred to CFS -v20, but there's no CFS versioning
    needed within the upstream kernel.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 1baf87cceb7c..29f2c21e7da2 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -171,7 +171,7 @@ static int sched_debug_show(struct seq_file *m, void *v)
 	u64 now = ktime_to_ns(ktime_get());
 	int cpu;
 
-	SEQ_printf(m, "Sched Debug Version: v0.04, cfs-v20, %s %.*s\n",
+	SEQ_printf(m, "Sched Debug Version: v0.05, %s %.*s\n",
 		init_utsname()->release,
 		(int)strcspn(init_utsname()->version, " "),
 		init_utsname()->version);

commit a5968df8737eda477d9d1038f5428ebd4d0884e1
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Jul 11 21:21:47 2007 +0200

    [PATCH] sched: allow larger granularity
    
    Allow granularity up to 100 msecs, instead of 10 msecs.
    (needed on larger boxes)
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/kernel/sched.c b/kernel/sched.c
index 2ab7fa8039ae..9088c2d97148 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4778,7 +4778,7 @@ cpumask_t nohz_cpu_mask = CPU_MASK_NONE;
 static inline void sched_init_granularity(void)
 {
 	unsigned int factor = 1 + ilog2(num_online_cpus());
-	const unsigned long gran_limit = 10000000;
+	const unsigned long gran_limit = 100000000;
 
 	sysctl_sched_granularity *= factor;
 	if (sysctl_sched_granularity > gran_limit)

commit c31f2e8a42c41efa46397732656ddf48cc77593e
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Jul 9 18:52:01 2007 +0200

    sched: add CFS credits
    
    add credits for recent major scheduler contributions:
    
      Con Kolivas, for pioneering the fair-scheduling approach
      Peter Williams, for smpnice
      Mike Galbraith, for interactivity tuning of CFS
      Srivatsa Vaddagiri, for group scheduling enhancements
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/kernel/sched.c b/kernel/sched.c
index 0e3caf742ae3..9fbced64bfee 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -16,6 +16,12 @@
  *		by Davide Libenzi, preemptible kernel bits by Robert Love.
  *  2003-09-03	Interactivity tuning by Con Kolivas.
  *  2004-04-02	Scheduler domains code by Nick Piggin
+ *  2007-04-15  Work begun on replacing all interactivity tuning with a
+ *              fair scheduling design by Con Kolivas.
+ *  2007-05-05  Load balancing (smp-nice) and other improvements
+ *              by Peter Williams
+ *  2007-05-06  Interactivity improvements to CFS by Mike Galbraith
+ *  2007-07-01  Group scheduling enhancements by Srivatsa Vaddagiri
  */
 
 #include <linux/mm.h>

commit 6fb43d7b50e49a36f8be3199141bec473e5ecb00
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Jul 9 18:52:01 2007 +0200

    sched: micro-optimize mmdrop()
    
    micro-optimize mmdrop(). Improves schedule()'s assembly a bit.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 785ec8465bd3..cfb680585ab8 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1514,7 +1514,7 @@ extern struct mm_struct * mm_alloc(void);
 extern void FASTCALL(__mmdrop(struct mm_struct *));
 static inline void mmdrop(struct mm_struct * mm)
 {
-	if (atomic_dec_and_test(&mm->mm_count))
+	if (unlikely(atomic_dec_and_test(&mm->mm_count)))
 		__mmdrop(mm);
 }
 

commit 9c4801cebc2add1fe514bc8eb201b16372eee11a
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Jul 9 18:52:01 2007 +0200

    sched: more agressive idle balancing
    
    the Linux scheduler is starving a number of workloads. So default
    to more agressive idle-balancing. This hurts lmbench context-switching
    numbers (which was the main reason we sucked at idle-balancing for
    such a long time) but the lmbench numbers are fine once the system is
    minimally utilized.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/include/linux/topology.h b/include/linux/topology.h
index a9d1f049cc15..da6c39b2d051 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -98,7 +98,7 @@
 	.cache_nice_tries	= 0,			\
 	.busy_idx		= 0,			\
 	.idle_idx		= 0,			\
-	.newidle_idx		= 1,			\
+	.newidle_idx		= 0,			\
 	.wake_idx		= 0,			\
 	.forkexec_idx		= 0,			\
 	.flags			= SD_LOAD_BALANCE	\
@@ -128,14 +128,15 @@
 	.imbalance_pct		= 125,			\
 	.cache_nice_tries	= 1,			\
 	.busy_idx		= 2,			\
-	.idle_idx		= 1,			\
-	.newidle_idx		= 2,			\
+	.idle_idx		= 0,			\
+	.newidle_idx		= 0,			\
 	.wake_idx		= 1,			\
 	.forkexec_idx		= 1,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_NEWIDLE	\
 				| SD_BALANCE_EXEC	\
 				| SD_WAKE_AFFINE	\
+				| SD_WAKE_IDLE		\
 				| SD_SHARE_PKG_RESOURCES\
 				| BALANCE_FOR_MC_POWER,	\
 	.last_balance		= jiffies,		\
@@ -158,14 +159,15 @@
 	.imbalance_pct		= 125,			\
 	.cache_nice_tries	= 1,			\
 	.busy_idx		= 2,			\
-	.idle_idx		= 1,			\
-	.newidle_idx		= 2,			\
+	.idle_idx		= 0,			\
+	.newidle_idx		= 0,			\
 	.wake_idx		= 1,			\
 	.forkexec_idx		= 1,			\
 	.flags			= SD_LOAD_BALANCE	\
 				| SD_BALANCE_NEWIDLE	\
 				| SD_BALANCE_EXEC	\
 				| SD_WAKE_AFFINE	\
+				| SD_WAKE_IDLE		\
 				| BALANCE_FOR_PKG_POWER,\
 	.last_balance		= jiffies,		\
 	.balance_interval	= 1,			\