[patch/backport] CFS scheduler, -v24, for v2.6.24-rc3, v2.6.23.8, v2.6.22.13, v2.6.21.7

Previous thread: [PATCH] serial_core: Bring mostly into line with coding style by Alan Cox on Monday, November 19, 2007 - 8:16 am. (1 message)

Next thread: [PATCH] belkin_sa: clean up for new style termios and speed handling, plus style by Alan Cox on Monday, November 19, 2007 - 8:18 am. (1 message)
From: Ingo Molnar
Date: Monday, November 19, 2007 - 8:17 am

By popular demand, here is release -v24 of the CFS scheduler patch.

It is a full backport of the latest & greatest scheduler code to 
v2.6.24-rc3, v2.6.23.8, v2.6.22.13, v2.6.21.7. The patches can be 
downloaded from the usual place:

    http://people.redhat.com/mingo/cfs-scheduler/

There's tons of changes since v22 was released:

    36 files changed, 2359 insertions(+), 1082 deletions(-)

that's 187 individual commits from 32 authors.

So even if CFS v22 worked well for you, please try this release too and 
report regressions (if any).

There are countless improvements in -v24 (see the shortlog further below 
for details), but here are a few highlights:

 - improved interactivity via Peter Ziljstra's "virtual slices" feature.
   As load increases, the scheduler shortens the virtual timeslices that 
   tasks get, so that applications observe the same constant latency for 
   getting on the CPU. (This goes on until the slices reach a minimum 
   granularity value)

 - CONFIG_FAIR_USER_SCHED is now available across all backported 
   kernels and the per user weights are configurable via 
   /sys/kernel/uids/. Group scheduling got refined all around.

 - performance improvements

 - bugfixes

99% of these changes are already upstream in Linus's git tree and they 
will be released as part of v2.6.24. (there are 4 pending commits that 
are in the small 2.6.24-rc3-v24 patch.)

As usual, any sort of feedback, bugreport, fix and suggestion is more 
than welcome!

	Ingo

------------------>
Adrian Bunk (3):
      sched: make kernel/sched.c:account_guest_time() static
      sched: proper prototype for kernel/sched.c:migration_init()
      sched: make sched_nr_latency static

Alexey Dobriyan (1):
      sched: uninline scheduler

Andi Kleen (5):
      sched: cleanup: remove unnecessary gotos
      sched: cleanup: refactor common code of sleep_on / wait_for_completion
      sched: cleanup: refactor normalize_rt_tasks
      sched: remove stale comment from ...
From: Fortier,Vincent [Montreal]
Date: Monday, November 19, 2007 - 9:04 am

Hi Ingo,

Thnx a lot for theses backports...

Ran into this while compiling a 2.6.22.13 with CFS v24

  CC      kernel/sched.o
kernel/sched.c: In function 'cpu_to_core_group':
kernel/sched.c:6056: error: 'per_cpu__cpu_sibling_map' undeclared (first
use in this function)
kernel/sched.c:6056: error: (Each undeclared identifier is reported only
once
kernel/sched.c:6056: error: for each function it appears in.)
kernel/sched.c:6056: warning: type defaults to 'int' in declaration of
'type name'
kernel/sched.c:6056: error: invalid type argument of 'unary *'
kernel/sched.c: In function 'build_sched_domains':
kernel/sched.c:6319: error: 'per_cpu__cpu_sibling_map' undeclared (first
use in this function)
kernel/sched.c:6319: warning: type defaults to 'int' in declaration of
'type name'
kernel/sched.c:6319: error: invalid type argument of 'unary *'
kernel/sched.c:6330: warning: type defaults to 'int' in declaration of
'type name'
kernel/sched.c:6330: error: invalid type argument of 'unary *'
make[2]: *** [kernel/sched.o] Error 1
make[1]: *** [kernel] Error 2
make[1]: Leaving directory
`/usr/src/linux-headers-2.6.22.13-cfs-sarge-686-envcan'
make: *** [debian/stamp-build-kernel] Error 2

- vin
-

From: Ingo Molnar
Date: Monday, November 19, 2007 - 11:59 am

find below the current set of fixlets - it should fix the 
cpu_sibling_map build error too. (or re-download the v24 patch again to 
get the fixes)

	Ingo

--- linux.orig/kernel/sysctl.c
+++ linux/kernel/sysctl.c
@@ -309,6 +309,7 @@ static struct ctl_table kern_table[] = {
 		.mode		= 644,
 		.proc_handler	= &proc_dointvec,
 	},
+#ifdef CONFIG_FAIR_GROUP_SCHED
 	{
 		.ctl_name	= CTL_UNNUMBERED,
 		.procname	= "sched_min_bal_int_shares",
@@ -326,6 +327,7 @@ static struct ctl_table kern_table[] = {
 		.proc_handler	= &proc_dointvec,
 	},
 #endif
+#endif
 	{
 		.ctl_name	= CTL_UNNUMBERED,
 		.procname	= "sched_compat_yield",
--- linux.orig/include/linux/sched.h
+++ linux/include/linux/sched.h
@@ -10,7 +10,7 @@
 #define COMPAT_REGISTER_SYSCTL
 
 /* backporting helper macro: */
-#define cpu_sibling_map(cpu) per_cpu(cpu_sibling_map, cpu)
+#define cpu_sibling_map(cpu) cpu_sibling_map[cpu]
 
 /*
  * cloning flags:
-

From: Erik Andersen
Date: Monday, November 19, 2007 - 11:12 am

Doesn't compile with 2.6.21.7:

kernel/sched.c: In function ‘cpu_to_core_group’:
kernel/sched.c:6056: error: ‘per_cpu__cpu_sibling_map’ undeclared (first use in this function)
kernel/sched.c:6056: error: (Each undeclared identifier is reported only once
kernel/sched.c:6056: error: for each function it appears in.)
kernel/sched.c:6056: warning: type defaults to ‘int’ in declaration of ‘type name’
kernel/sched.c:6056: error: invalid type argument of ‘unary *’
kernel/sched.c: In function ‘build_sched_domains’:
kernel/sched.c:6319: error: ‘per_cpu__cpu_sibling_map’ undeclared (first use in this function)
kernel/sched.c:6319: warning: type defaults to ‘int’ in declaration of ‘type name’
kernel/sched.c:6319: error: invalid type argument of ‘unary *’
kernel/sched.c:6330: warning: type defaults to ‘int’ in declaration of ‘type name’
kernel/sched.c:6330: error: invalid type argument of ‘unary *’
make[1]: *** [kernel/sched.o] Error 1
make[1]: *** Waiting for unfinished jobs....

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--
-

From: Ingo Molnar
Date: Monday, November 19, 2007 - 11:52 am

does the patch below help?

	Ingo

Index: linux-cfs-2.6.21.7.q/include/linux/sched.h
===================================================================
--- linux-cfs-2.6.21.7.q.orig/include/linux/sched.h
+++ linux-cfs-2.6.21.7.q/include/linux/sched.h
@@ -10,7 +10,7 @@
 #define COMPAT_REGISTER_SYSCTL
 
 /* backporting helper macro: */
-#define cpu_sibling_map(cpu) per_cpu(cpu_sibling_map, cpu)
+#define cpu_sibling_map(cpu) cpu_sibling_map[cpu]
 
 /*
  * cloning flags:

-

From: Erik Andersen
Date: Monday, November 19, 2007 - 12:24 pm

Yes, compiles and boots with that change,

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--
-

From: Fortier,Vincent [Montreal]
Date: Monday, November 19, 2007 - 12:46 pm

Looks good.  Compiling.

- vin
-

From: Damien Wyart
Date: Tuesday, November 20, 2007 - 4:24 am

Hello,


Testing sched-cfs-v2.6.24-rc3-v24.patch on top of 2.6.24-rc3-git1
(ignored the two "already applied" messages coming from git1 commits),
I get a 1.00 minimum load in top, coming from the load_balance_mo thread
staying in D-state. I get this on 2 different computers with similar
configs, so I am attaching one of them here.

-- 
Damien Wyart
From: Srivatsa Vaddagiri
Date: Tuesday, November 20, 2007 - 5:41 am

Ingo,
	I am reworking the fair-group load balance patches. Can you drop
what you have until I resubmit?

-- 
Regards,
vatsa
-

From: Ingo Molnar
Date: Tuesday, November 20, 2007 - 5:55 am

does the patch below fix that problem for you?

	Ingo

Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -7138,7 +7138,7 @@ static int load_balance_monitor(void *un
 		else if (timeout < sysctl_sched_max_bal_int_shares)
 			timeout *= 2;
 
-		msleep(timeout);
+		msleep_interruptible(timeout);
 	}
 
 	return 0;
-

From: Damien Wyart
Date: Tuesday, November 20, 2007 - 6:22 am

Yes, it does. Thanks for your answer.

-

From: Vincent Fortier
Date: Tuesday, November 20, 2007 - 1:00 pm

Hi Ingo,

Tested latest v24 patch against 686 & x86_64 and it runs smoothly, at
least as well as previous v22 release.

As always, Thnx very much for this backport.

- vin


-

From: Fabio Comolli
Date: Tuesday, November 20, 2007 - 1:38 pm

Hi.
First, thanks for this patch. I don't have numbers but working with my
laptop feels much better.
Just a question: does the patch include the fix (divide by zero....)
you just posted in the stable review for 2.6.23.9?

Thanks and regards,
Fabio



-

From: Ingo Molnar
Date: Tuesday, November 20, 2007 - 1:41 pm

yeah.

	Ingo
-

From: Fabio Comolli
Date: Tuesday, November 20, 2007 - 1:47 pm

Hi



OK, thanks. Have you already tried to apply the patch to 2.6.23.9?

Regards,
Fabio
-

From: Ingo Molnar
Date: Tuesday, November 20, 2007 - 2:53 pm

are you sure? The last -ck patch i can find is for .22:

  http://www.kernel.org/pub/linux/kernel/people/ck/patches/2.6/

or have they been forward ported? (if yes, do you have an URL for that)

(my guess is you used the 2.6.23.1 scheduler (CFS), so the improvement 
you felt on the laptop is relative to 2.6.23-vanilla in essence - which 

hm:

The latest stable version of the Linux kernel is:           2.6.23.8

so there's no 23.9 yet.

	Ingo
-

From: Fabio Comolli
Date: Wednesday, November 21, 2007 - 1:50 am

Hi

On Nov 20, 2007 10:53 PM, Ingo Molnar <mingo@elte.hu> wrote:

Well, it seems that Matthew has been faster than me :-) Yes, I got -ck

I meant the 23.9 patches that Greg KH posted some hours ago for
review. I guess I will find myself in a couple of days.

To answer your latest mail, again I don't have numbers but from my
point ov view:

23.1 < 23.1+ck < 23.8+cfs.24

where 23.1+ck is slightly better than vanilla 23.1 and 23.8+cfs.24 is
much better than 23.1+ck.

My workload is pretty standard, F8+kde+firefox+kmail+amsn, some kernel
compile and so on.

Regards,
Fabio
-

From: Ingo Molnar
Date: Wednesday, November 21, 2007 - 3:39 am

do you remember which particular workload improved the most, and in 
roughly whatway? (no need for numbers - subjective impressions are 
accurate enough for this)

	Ingo
-

From: Fabio Comolli
Date: Wednesday, November 21, 2007 - 4:11 am

Hi


Firefox, especially when multiple tabs are open. Sometimes I used to

Regards,
Fabio
-

From: Ingo Molnar
Date: Monday, November 26, 2007 - 1:59 pm

update: there's now a CFS-v24 patch available for v2.6.23.9 as well.

	Ingo
-

Previous thread: [PATCH] serial_core: Bring mostly into line with coding style by Alan Cox on Monday, November 19, 2007 - 8:16 am. (1 message)

Next thread: [PATCH] belkin_sa: clean up for new style termios and speed handling, plus style by Alan Cox on Monday, November 19, 2007 - 8:18 am. (1 message)