2007-06-14 22:49:49

by Ingo Molnar

[permalink] [raw]
Subject: [patch] CFS scheduler, -v17


i'm pleased to announce release -v17 of the CFS scheduler patchset.

The rolled-up CFS patch against v2.6.22-rc4, v2.6.22-rc4-mm2, v2.6.21.5
or v2.6.20.13 can be downloaded from the usual place:

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

-v17 includes a bigger change: the CFS-core changes in preparation of
the group-scheduling feature, written Srivatsa Vaddagiri. Dmitry
Adamushko provided cleanups and further generalizations to this code and
the modularization of CFS has been further enhanced as a result. To
users, these changes are mostly invisible.

Changes since -v16:

- lots of core updates to support group scheduling, and related
cleanups. (Srivatsa Vaddagiri, Dmitry Adamushko)

- tuned the runtime-limit up a bit, based on relentless testing done by
Tobias Gerschner.

- the new, precise load-calculation method for SMP balancing has been
further enhanced, and is now active by default. (Dmitry Adamushko)

- fix SCHED_IDLEPRIO support (based on feedback from Thomas Sattler)

- further updates to /proc/sched_debug and /proc/PID/sched

- more cleanups

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

Ingo


Subject: Re: [patch] CFS scheduler, -v17

Em Fri, 15 Jun 2007 00:49:08 +0200
Ingo Molnar <[email protected]> escreveu:

|
| i'm pleased to announce release -v17 of the CFS scheduler patchset.
|
| The rolled-up CFS patch against v2.6.22-rc4, v2.6.22-rc4-mm2, v2.6.21.5
| or v2.6.20.13 can be downloaded from the usual place:
|
| http://people.redhat.com/mingo/cfs-scheduler/

Hmm, I'm getting this while compiling:

"""
LD .tmp_vmlinux1
kernel/built-in.o: In function `rq_clock':
/home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321: undefined reference to `cpu_of'
/home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321: undefined reference to `cpu_of'
/home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321: undefined reference to `cpu_of'
/home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321: undefined reference to `cpu_of'
/home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321: undefined reference to `cpu_of'
kernel/built-in.o:/home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321: more undefined references to `cpu_of' follow
make: *** [.tmp_vmlinux1] Error 1
"""

The code in question is really strange:

#ifdef CONFIG_SMP
...
static inline int cpu_of(struct rq *rq)
#ifdef CONFIG_SMP
return rq->cpu;
#else
return 0;
#endif
}
...
#endif

Patch follows, only compile tested, hope it helps.

------

[PATCH]: Fix undefined reference to `cpu_of'

cpu_of() is defined inside a CONFIG_SMP #ifdef/#endif but called
by !CONFIG_SMP code.

This patch fixes that by creating a !CONFIG_SMP version of cpu_of().

Signed-off-by: Luiz Fernando N. Capitulino <[email protected]>

diff --git a/kernel/sched.c b/kernel/sched.c
index abe6fab..be63f73 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -259,13 +259,9 @@ static inline u32 sg_div_cpu_power(const struct sched_group *sg, u32 load)
return reciprocal_divide(load, sg->reciprocal_cpu_power);
}

-static inline int cpu_of(struct rq *rq)
+static inline int cpu_of(const struct rq *rq)
{
-#ifdef CONFIG_SMP
return rq->cpu;
-#else
- return 0;
-#endif
}

/*
@@ -277,7 +273,13 @@ static inline void sg_inc_cpu_power(struct sched_group *sg, u32 val)
sg->__cpu_power += val;
sg->reciprocal_cpu_power = reciprocal_value(sg->__cpu_power);
}
-#endif
+#else /* !CONFIG_SMP */
+static inline int cpu_of(const struct rq *rq)
+{
+ return 0;
+}
+#endif /* CONFIG_SMP */
+
/*
* Per-runqueue clock, as finegrained as the platform can give us:
*/


--
Luiz Fernando N. Capitulino

2007-06-15 17:49:52

by Miguel Botón

[permalink] [raw]
Subject: Re: [patch] CFS scheduler, -v17

On Friday 15 June 2007 18:28, Luiz Fernando N. Capitulino wrote:
> Hmm, I'm getting this while compiling:
>
> """
> LD .tmp_vmlinux1
> kernel/built-in.o: In function `rq_clock':
> /home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321:
> undefined reference to `cpu_of'
> /home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321:
> undefined reference to `cpu_of'
> /home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321:
> undefined reference to `cpu_of'
> /home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321:
> undefined reference to `cpu_of'
> /home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321:
> undefined reference to `cpu_of'
> kernel/built-in.o:/home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kern
>el/sched.c:321: more undefined references to `cpu_of' follow make: ***
> [.tmp_vmlinux1] Error 1
> """
>
> The code in question is really strange:
>
> #ifdef CONFIG_SMP
> ...
> static inline int cpu_of(struct rq *rq)
> #ifdef CONFIG_SMP
> return rq->cpu;
> #else
> return 0;
> #endif
> }
> ...
> #endif

I patched kernel 2.6.21.5 with CFS v17 and I didn't experience this problem (I
checked that piece of code and I didn't see something wrong).
Looks like it only appears in kernel 2.6.22-rc4.

--
Miguel Bot?n

2007-06-15 19:04:05

by Gabriel C

[permalink] [raw]
Subject: Re: [patch] CFS scheduler, -v17

Miguel Bot?n wrote:
> On Friday 15 June 2007 18:28, Luiz Fernando N. Capitulino wrote:
>
>> Hmm, I'm getting this while compiling:
>>
>> """
>> LD .tmp_vmlinux1
>> kernel/built-in.o: In function `rq_clock':
>> /home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321:
>> undefined reference to `cpu_of'
>> /home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321:
>> undefined reference to `cpu_of'
>> /home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321:
>> undefined reference to `cpu_of'
>> /home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321:
>> undefined reference to `cpu_of'
>> /home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321:
>> undefined reference to `cpu_of'
>> kernel/built-in.o:/home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kern
>> el/sched.c:321: more undefined references to `cpu_of' follow make: ***
>> [.tmp_vmlinux1] Error 1
>> """
>>
>> The code in question is really strange:
>>
>> #ifdef CONFIG_SMP
>> ...
>> static inline int cpu_of(struct rq *rq)
>> #ifdef CONFIG_SMP
>> return rq->cpu;
>> #else
>> return 0;
>> #endif
>> }
>> ...
>> #endif
>>
>
> I patched kernel 2.6.21.5 with CFS v17 and I didn't experience this problem (I
> checked that piece of code and I didn't see something wrong).
> Looks like it only appears in kernel 2.6.22-rc4.
>
>
I guess this code is missing #ifdef CONFIG_SMP ?

....

static inline unsigned long long rq_clock(struct rq *rq)
{
int this_cpu = smp_processor_id();

if (this_cpu == cpu_of(rq))
return __rq_clock(rq);

return rq->clock;
}


....

Gabriel

2007-06-15 19:27:03

by Vincent Fortier

[permalink] [raw]
Subject: RE: [patch] CFS scheduler, -v17

> -----Message d'origine-----
> De : [email protected]
> [mailto:[email protected]] De la part de Ingo Molnar
> Envoy? : 14 juin 2007 18:49
>
> i'm pleased to announce release -v17 of the CFS scheduler patchset.
>
> The rolled-up CFS patch against v2.6.22-rc4, v2.6.22-rc4-mm2,
> v2.6.21.5 or v2.6.20.13 can be downloaded from the usual place:
>
> http://people.redhat.com/mingo/cfs-scheduler/
>
> -v17 includes a bigger change: the CFS-core changes in
> preparation of the group-scheduling feature, written Srivatsa
> Vaddagiri. Dmitry Adamushko provided cleanups and further
> generalizations to this code and the modularization of CFS
> has been further enhanced as a result. To users, these
> changes are mostly invisible.
>
> Changes since -v16:
>
> - lots of core updates to support group scheduling, and related
> cleanups. (Srivatsa Vaddagiri, Dmitry Adamushko)
>
> - tuned the runtime-limit up a bit, based on relentless
> testing done by
> Tobias Gerschner.
>
> - the new, precise load-calculation method for SMP balancing has been
> further enhanced, and is now active by default. (Dmitry Adamushko)
>
> - fix SCHED_IDLEPRIO support (based on feedback from Thomas Sattler)
>
> - further updates to /proc/sched_debug and /proc/PID/sched
>
> - more cleanups
>
> As usual, any sort of feedback, bugreport, fix and suggestion
> is more than welcome!

Fedora 7 & Debian Sarge 3.1 kernels using latest CFS v17 available at http://linux-dev.qc.ec.gc.ca/
YUM users: http://linux-dev.qc.ec.gc.ca/kernel/fedora/alt-sched.repo

Thnx Ingo & cie.

> Ingo

- vin

2007-06-15 19:31:25

by Ingo Molnar

[permalink] [raw]
Subject: Re: [patch] CFS scheduler, -v17


* Luiz Fernando N. Capitulino <[email protected]> wrote:

> Hmm, I'm getting this while compiling:
>
> """
> LD .tmp_vmlinux1
> kernel/built-in.o: In function `rq_clock':
> /home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321: undefined reference to `cpu_of'
> /home/lcapitulino/src/kernels/upstream/linux-2.6-cfs/kernel/sched.c:321: undefined reference to `cpu_of'

oops :-) That was due to !CONFIG_SMP.

> Patch follows, only compile tested, hope it helps.

Thanks! I fixed it in a slightly different way: moved the cpu_of() thing
outside of the #ifdef CONFIG_SMP section, as per the patch below. I've
updated the -v17 patches with this minimal fix and have verified that
the !CONFIG_SMP kernel boots and works fine.

Ingo

--------------->
Index: linux-cfs-2.6.22-rc4.q/kernel/sched.c
===================================================================
--- linux-cfs-2.6.22-rc4.q.orig/kernel/sched.c
+++ linux-cfs-2.6.22-rc4.q/kernel/sched.c
@@ -248,6 +249,15 @@ static unsigned int static_prio_timeslic
return SCALE_PRIO(DEF_TIMESLICE, static_prio);
}

+static inline int cpu_of(struct rq *rq)
+{
+#ifdef CONFIG_SMP
+ return rq->cpu;
+#else
+ return 0;
+#endif
+}
+
#ifdef CONFIG_SMP
/*
* Divide a load by a sched group cpu_power : (load / sg->__cpu_power)
@@ -258,15 +268,6 @@ static inline u32 sg_div_cpu_power(const
return reciprocal_divide(load, sg->reciprocal_cpu_power);
}

-static inline int cpu_of(struct rq *rq)
-{
-#ifdef CONFIG_SMP
- return rq->cpu;
-#else
- return 0;
-#endif
-}
-
/*
* Each time a sched group cpu_power is changed,
* we must compute its reciprocal value

2007-06-15 19:34:42

by Ingo Molnar

[permalink] [raw]
Subject: Re: [patch] CFS scheduler, -v17


* Miguel Bot?n <[email protected]> wrote:

> I patched kernel 2.6.21.5 with CFS v17 and I didn't experience this
> problem (I checked that piece of code and I didn't see something
> wrong). Looks like it only appears in kernel 2.6.22-rc4.

yeah - it affected the .22 patches, the .21 and .20 patches compiled and
worked under !CONFIG_SMP too. I updated the .22 patches with the fix
below.

Ingo

-------------->
Index: linux-cfs-2.6.22-rc4.q/kernel/sched.c
===================================================================
--- linux-cfs-2.6.22-rc4.q.orig/kernel/sched.c
+++ linux-cfs-2.6.22-rc4.q/kernel/sched.c
@@ -248,6 +249,15 @@ static unsigned int static_prio_timeslic
return SCALE_PRIO(DEF_TIMESLICE, static_prio);
}

+static inline int cpu_of(struct rq *rq)
+{
+#ifdef CONFIG_SMP
+ return rq->cpu;
+#else
+ return 0;
+#endif
+}
+
#ifdef CONFIG_SMP
/*
* Divide a load by a sched group cpu_power : (load / sg->__cpu_power)
@@ -258,15 +268,6 @@ static inline u32 sg_div_cpu_power(const
return reciprocal_divide(load, sg->reciprocal_cpu_power);
}

-static inline int cpu_of(struct rq *rq)
-{
-#ifdef CONFIG_SMP
- return rq->cpu;
-#else
- return 0;
-#endif
-}
-
/*
* Each time a sched group cpu_power is changed,
* we must compute its reciprocal value

2007-06-22 07:36:21

by Tom Spink

[permalink] [raw]
Subject: Re: [patch] CFS scheduler, -v17

On 14/06/07, Ingo Molnar <[email protected]> wrote:
>
> i'm pleased to announce release -v17 of the CFS scheduler patchset.
>
> The rolled-up CFS patch against v2.6.22-rc4, v2.6.22-rc4-mm2, v2.6.21.5
> or v2.6.20.13 can be downloaded from the usual place:
>
> http://people.redhat.com/mingo/cfs-scheduler/
>
> -v17 includes a bigger change: the CFS-core changes in preparation of
> the group-scheduling feature, written Srivatsa Vaddagiri. Dmitry
> Adamushko provided cleanups and further generalizations to this code and
> the modularization of CFS has been further enhanced as a result. To
> users, these changes are mostly invisible.
>
> Changes since -v16:
>
> - lots of core updates to support group scheduling, and related
> cleanups. (Srivatsa Vaddagiri, Dmitry Adamushko)
>
> - tuned the runtime-limit up a bit, based on relentless testing done by
> Tobias Gerschner.
>
> - the new, precise load-calculation method for SMP balancing has been
> further enhanced, and is now active by default. (Dmitry Adamushko)
>
> - fix SCHED_IDLEPRIO support (based on feedback from Thomas Sattler)
>
> - further updates to /proc/sched_debug and /proc/PID/sched
>
> - more cleanups
>
> As usual, any sort of feedback, bugreport, fix and suggestion is more
> than welcome!
>
> Ingo
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

Hi everyone,

I'm just writing to say how impressed I am with the new CFS scheduler.
I've been following it's development from the first patch, right up
to now (running on the latest vanilla kernel I could!) and I can
honestly say I've never had such a responsive experience.

I'm currently writing a major patch to the ext2 file-system driver, as
part of a University project - it involves a lot of kernel rebuilds as
I'm testing the patch in UML. I've had a couple of kernel compiles
happening simultaneously (on my moderate single CPU PC), and tried out
a few make -j12's, and I'm amazed at the difference the new scheduler
makes.

I've got quite a few instances of Firefox (whoops, Iceweasel) open,
I'm listening to music and theres a few other apps running (like KNode
the newsreader) and the interactivity response has been excellent.

In conclusion, well done to the scheduler people and I look forward to
seeing this go to mainline.

(If there's anything I can do to help, I'd love to throw a few patches
at the mailing list ;)

--
Regards,
Tom Spink
University of Edinburgh