Hi Ingo,
FWIW, I have placed all my latest upstream-able scheduler patches into
a branch in my git tree (against tip/master).
git://git.kernel.org/pub/scm/linux/kernel/git/ghaskins/linux-2.6-hacks.git
sched/latest
Gregory Haskins (11):
sched: cleanup inc/dec_rt_tasks
sched: track the next-highest priority on each runqueue
sched: use highest_prio.curr for pull threshold
sched: use highest_prio.next to optimize pull operations
sched: only try to push a task on wakeup if it is migratable
sched: pull only one task during NEWIDLE balancing to limit
critical section
sched: make double-lock-balance fair
sched: add sched_class->needs_post_schedule() member
plist: fix PLIST_NODE_INIT to work with debug enabled
sched: create "pushable_tasks" list to limit pushing to one attempt
RT: fix push_rt_task() to handle dequeue_pushable properly
include/linux/init_task.h | 1 +
include/linux/plist.h | 9 +-
include/linux/sched.h | 2 +
kernel/sched.c | 89 +++++++++++--
kernel/sched_rt.c | 324
+++++++++++++++++++++++++++++++--------------
5 files changed, 312 insertions(+), 113 deletions(-)
These are built/booted on my quad-core/x86_64 and look good to me.
1) the first four are the "next-highest" v3 patches that I submitted
yesterday
2) the last seven are patches that Steven has carried in 26-rt that have
not yet been pulled in to tip
I assume there is an implicit ACK from Steven on (2) since he pulled
them into -rt. We still await comment from Peter re: (1).
Regards,
-Greg
pulled into tip/cpus4096, thanks Gregory! (It goes into the cpumask tree because it already changed a few areas that you relied on.) Ingo --
From a9750309ef51081abb17268936769511b3683488 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@elte.hu>
Date: Mon, 8 Dec 2008 16:39:24 +0100
Subject: [PATCH] sched: fix build failure in kernel/sched_rt.c
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Impact: build fix
fix:
kernel/sched_rt.c: In function ‘inc_rt_tasks’:
kernel/sched_rt.c:593: error: ‘prio’ undeclared (first use in this function)
kernel/sched_rt.c:593: error: (Each undeclared identifier is reported only once
kernel/sched_rt.c:593: error: for each function it appears in.)
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/sched_rt.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index c5b1c5a..64a8f0a 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -583,9 +583,7 @@ static inline int next_prio(struct rq *rq)
static inline
void inc_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
{
-#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
int prio = rt_se_prio(rt_se);
-#endif
#ifdef CONFIG_SMP
struct rq *rq = rq_of_rt_rq(rt_rq);
#endif
--
Doh! -Greg "always breakin' uniprocessor" Haskins
okay, this series is quite bad so i'm disabling it for now. I sent a build fix earlier today, then i triggered this build failure: kernel/built-in.o: In function `dequeue_pushable_task': sched.c:(.text+0x4a9f): undefined reference to `plist_del' kernel/built-in.o: In function `enqueue_pushable_task': sched.c:(.text+0x5734): undefined reference to `plist_del' sched.c:(.text+0x5747): undefined reference to `plist_add' and then this: kernel/sched_rt.c: In function ‘next_prio’: kernel/sched_rt.c:574: error: ‘struct rq’ has no member named ‘cpu’ kernel/sched_rt.c: In function ‘inc_rt_tasks’: kernel/sched_rt.c:619: error: ‘rq’ undeclared (first use in this function) kernel/sched_rt.c:619: error: (Each undeclared identifier is reported only once kernel/sched_rt.c:619: error: for each function it appears in.) kernel/sched_rt.c: In function ‘dec_rt_tasks’: kernel/sched_rt.c:667: error: ‘rq’ undeclared (first use in this function) Ingo --
Hi Ingo, I was able to reproduce your first error (in the previous mail) by turning off CONFIG_SMP. I have folded your fix into my series and got past it. However, I was not able to reproduce these two new errors. I was thinking that perhaps something merged improperly between my (older) tip/master and the merge point in cpus4096. So I rebased the series on your latest tip/master as of this morning, but it still builds fine for me. Could you send me the .config that causes this to blow up? I will get it straightened out for you ASAP. Sorry for the inconvenience. Thanks, -Greg
Could you send a delta fix against cpus4096 for that bug you fixed? Ingo --
in fact ... i had to temporarily remove your patches because it held tip/cpus4096 hostage and there were other patches waiting to be queued up there. Latest sched/core is now included in cpus4096, so please resend the series against that tree. Ingo --
Hey Ingo, Just getting back online now, sorry for the delay. I will look at getting this series working against cpus4096 as you requested. -Greg
Hi Ingo,
I have rebased the series against tip/cpus4096 as of today. I
built/boot this kernel for both SMP/UP on a 4-way x86_64 box, and they
look sane. Let me know if they still look broken to you.
The following changes since commit 6092848a2a23b660150a38bc06f59d75838d70c8:
Sergio Luis (1):
x86: mark get_cpu_leaves() with __cpuinit annotation
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/ghaskins/linux-2.6-hacks.git
sched/latest
Gregory Haskins (11):
sched: cleanup inc/dec_rt_tasks
sched: track the next-highest priority on each runqueue
sched: use highest_prio.curr for pull threshold
sched: use highest_prio.next to optimize pull operations
sched: only try to push a task on wakeup if it is migratable
sched: pull only one task during NEWIDLE balancing to limit
critical section
sched: make double-lock-balance fair
sched: add sched_class->needs_post_schedule() member
plist: fix PLIST_NODE_INIT to work with debug enabled
sched: create "pushable_tasks" list to limit pushing to one attempt
RT: fix push_rt_task() to handle dequeue_pushable properly
include/linux/init_task.h | 1 +
include/linux/plist.h | 9 +-
include/linux/sched.h | 2 +
kernel/sched.c | 89 +++++++++++--
kernel/sched_rt.c | 324
+++++++++++++++++++++++++++++++--------------
5 files changed, 311 insertions(+), 114 deletions(-)
pulled into tip/sched/rt, thanks Gregory! Ingo --
yes, i still get build failures: kernel/sched_rt.c:574: error: 'struct rq' has no member named 'cpu' kernel/sched_rt.c:619: error: 'rq' undeclared (first use in this function) kernel/sched_rt.c:619: error: (Each undeclared identifier is reported only once kernel/sched_rt.c:619: error: for each function it appears in.) kernel/sched_rt.c:667: error: 'rq' undeclared (first use in this function) so i've excluded tip/sched/rt from tip/master for now. Ingo --
Hey Ingo, Sorry for all these problems. I am not sure what is happening since it seems to build fine for me on this end. I just pulled down tip/sched/rt (sha 0a6d4e1dc9154c4376358663d74060d1e33d203e) and built for my x86_64 machine with both SMP and UP (configs attached). They both completed without errors. Could you send me the config you are having trouble with? /me scratches head. -Greg
dont have it anymore - but you can look at the build error itself and figure out what config options it needs to trigger such problems - and whether the code could be simplified/streamlined to not run into such issues. If there's no #ifdef in a .c file there's rarely such problems. Ingo --
Yes, of course. At least one of us has engaged their brains this AM ;) Thanks. Fix forthcoming. -Greg
The following changes since commit 0a6d4e1dc9154c4376358663d74060d1e33d203e:
Ingo Molnar (1):
Merge branch 'sched/latest' of git://git.kernel.org/.../ghaskins/linux-2.6-hacks into sched/rt
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/ghaskins/linux-2.6-hacks.git sched/latest
Gregory Haskins (1):
sched: fix build error in kernel/sched_rt.c when RT_GROUP_SCHED && !SMP
kernel/sched.c | 4 +
kernel/sched_rt.c | 223 +++++++++++++++++++++++++++++++----------------------
2 files changed, 136 insertions(+), 91 deletions(-)
---------------------------
sched: fix build error in kernel/sched_rt.c when RT_GROUP_SCHED && !SMP
Ingo found a build error in the scheduler when RT_GROUP_SCHED was
enabled, but SMP was not. This patch rearranges the code such
that it is a little more streamlined and compiles under all permutations
of SMP, UP and RT_GROUP_SCHED. It was boot tested on my 4-way x86_64
and it still passes preempt-test.
Signed-off-by: Gregory Haskins <ghaskins@novell.com>
---
kernel/sched.c | 4 +
kernel/sched_rt.c | 223 +++++++++++++++++++++++++++++++----------------------
2 files changed, 136 insertions(+), 91 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index dd1a146..2b703f1 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -466,7 +466,9 @@ struct rt_rq {
#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
struct {
int curr; /* highest queued rt task prio */
+#ifdef CONFIG_SMP
int next; /* next highest */
+#endif
} highest_prio;
#endif
#ifdef CONFIG_SMP
@@ -8267,8 +8269,10 @@ static void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq)
#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
rt_rq->highest_prio.curr = MAX_RT_PRIO;
+#ifdef CONFIG_SMP
rt_rq->highest_prio.next = MAX_RT_PRIO;
#endif
+#endif
#ifdef CONFIG_SMP
rt_rq->rt_nr_migratory = 0;
rt_rq->overloaded = 0;
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index ...Hi Ingo,
<snip>
Yeah, good ideas. Here's a v2 (also pushed to my sched/latest branch on
kernel.org)
-Greg
----------------------------------
sched: fix build error in kernel/sched_rt.c when RT_GROUP_SCHED && !SMP
Ingo found a build error in the scheduler when RT_GROUP_SCHED was
enabled, but SMP was not. This patch rearranges the code such
that it is a little more streamlined and compiles under all permutations
of SMP, UP and RT_GROUP_SCHED. It was boot tested on my 4-way x86_64
and it still passes preempt-test.
Signed-off-by: Gregory Haskins <ghaskins@novell.com>
---
kernel/sched.c | 4 +
kernel/sched_rt.c | 261 ++++++++++++++++++++++++++++++++++-------------------
2 files changed, 170 insertions(+), 95 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index dd1a146..2b703f1 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -466,7 +466,9 @@ struct rt_rq {
#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
struct {
int curr; /* highest queued rt task prio */
+#ifdef CONFIG_SMP
int next; /* next highest */
+#endif
} highest_prio;
#endif
#ifdef CONFIG_SMP
@@ -8267,8 +8269,10 @@ static void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq)
#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
rt_rq->highest_prio.curr = MAX_RT_PRIO;
+#ifdef CONFIG_SMP
rt_rq->highest_prio.next = MAX_RT_PRIO;
#endif
+#endif
#ifdef CONFIG_SMP
rt_rq->rt_nr_migratory = 0;
rt_rq->overloaded = 0;
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 18c7b5b..b0f3184 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -3,6 +3,40 @@
* policies)
*/
+static inline struct task_struct *rt_task_of(struct sched_rt_entity *rt_se)
+{
+ return container_of(rt_se, struct task_struct, rt);
+}
+
+#ifdef CONFIG_RT_GROUP_SCHED
+
+static inline struct rq *rq_of_rt_rq(struct rt_rq *rt_rq)
+{
+ return rt_rq->rq;
+}
+
+static inline struct rt_rq *rt_rq_of_se(struct sched_rt_entity *rt_se)
+{
+ return ...Please dont _ever_ introduce new CPP macros into core kernel code, and if you see existing once, please fix them to be proper C inline functions. (there's a few other new macros in your patchset) Ingo --
Generally good advice, and certainly doable in this case. But in some very rare occasions I've had to use CPP in order to avoid silly header dependency hell -- I think we should add comments in such cases as to why we use CPP. --
yeah - that's why i qualified it with 'core kernel code', not 'headers'. (But even in the dependency spaghetti case the right solution is to clean up the header dependencies. It's just very hard in most cases due to most folks running on x86 and there being 20+ other architectures they cannot really test. So the dependency hell tends to grow not shrink. ) Ingo --
Hey guys, Sorry, wasn't aware of that rule. Ill spin a v3 and send it out later today. -Greg
Hi Ingo,
Here is the latest iteration of the patch. V3 is identical to v2 except
I converted all the CPP violations to static-inlines. I also included
a new patch (1/2) to fix a previous CPP macro that I introduced to the tree.
I verified that this builds for both SMP and UP.
As before, you can also find these patches in my git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/ghaskins/linux-2.6-hacks.git sched/latest
-Greg
---
Gregory Haskins (2):
sched: fix build error in kernel/sched_rt.c when RT_GROUP_SCHED && !SMP
sched: de CPP-ify the scheduler code
kernel/sched.c | 4 +
kernel/sched_rt.c | 270 ++++++++++++++++++++++++++++++++++-------------------
2 files changed, 178 insertions(+), 96 deletions(-)
--
Signed-off-by: Gregory Haskins <ghaskins@novell.com>
---
kernel/sched_rt.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 18c7b5b..4eda5f7 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -64,8 +64,10 @@ static void dequeue_pushable_task(struct rq *rq, struct task_struct *p)
#else
-#define enqueue_pushable_task(rq, p) do { } while (0)
-#define dequeue_pushable_task(rq, p) do { } while (0)
+static inline
+void enqueue_pushable_task(struct rq *rq, struct task_struct *p) {}
+static inline
+void dequeue_pushable_task(struct rq *rq, struct task_struct *p) {}
#endif /* CONFIG_SMP */
--
Wouldn't the above look better as:
static inline void
enqueue_pushable_task(struct rq *rq, struct task_struct *p)
{
}
static inline void
dequeue_pushable_task(struct rq *rq, struct task_struct *p)
{
}
-- Steve
--
I personally like to try to keep disabled functions ideally as close to one line as possible to visually denote that it isn't doing anything worth looking at. But I don't feel strongly either way, so whatever makes you guys happy. :) Shall I convert the others to this form as well? -Greg
Ingo found a build error in the scheduler when RT_GROUP_SCHED was
enabled, but SMP was not. This patch rearranges the code such
that it is a little more streamlined and compiles under all permutations
of SMP, UP and RT_GROUP_SCHED. It was boot tested on my 4-way x86_64
and it still passes preempt-test.
Signed-off-by: Gregory Haskins <ghaskins@novell.com>
---
kernel/sched.c | 4 +
kernel/sched_rt.c | 264 ++++++++++++++++++++++++++++++++++-------------------
2 files changed, 174 insertions(+), 94 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index dd1a146..2b703f1 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -466,7 +466,9 @@ struct rt_rq {
#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
struct {
int curr; /* highest queued rt task prio */
+#ifdef CONFIG_SMP
int next; /* next highest */
+#endif
} highest_prio;
#endif
#ifdef CONFIG_SMP
@@ -8267,8 +8269,10 @@ static void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq)
#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
rt_rq->highest_prio.curr = MAX_RT_PRIO;
+#ifdef CONFIG_SMP
rt_rq->highest_prio.next = MAX_RT_PRIO;
#endif
+#endif
#ifdef CONFIG_SMP
rt_rq->rt_nr_migratory = 0;
rt_rq->overloaded = 0;
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 4eda5f7..4230b15 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -3,6 +3,40 @@
* policies)
*/
+static inline struct task_struct *rt_task_of(struct sched_rt_entity *rt_se)
+{
+ return container_of(rt_se, struct task_struct, rt);
+}
+
+#ifdef CONFIG_RT_GROUP_SCHED
+
+static inline struct rq *rq_of_rt_rq(struct rt_rq *rt_rq)
+{
+ return rt_rq->rq;
+}
+
+static inline struct rt_rq *rt_rq_of_se(struct sched_rt_entity *rt_se)
+{
+ return rt_se->rt_rq;
+}
+
+#else /* CONFIG_RT_GROUP_SCHED */
+
+static inline struct rq *rq_of_rt_rq(struct rt_rq *rt_rq)
+{
+ return container_of(rt_rq, struct rq, rt);
+}
+
+static inline struct rt_rq *rt_rq_of_se(struct sched_rt_entity ...pulled into tip/sched/rt, thanks Greg! Ingo --
here's a new build failure with tip/sched/rt: LD .tmp_vmlinux1 kernel/built-in.o: In function `set_curr_task_rt': sched.c:(.text+0x3675): undefined reference to `plist_del' kernel/built-in.o: In function `pick_next_task_rt': sched.c:(.text+0x37ce): undefined reference to `plist_del' kernel/built-in.o: In function `enqueue_pushable_task': sched.c:(.text+0x381c): undefined reference to `plist_del' Ingo
diff --git a/init/Kconfig b/init/Kconfig
index 6504ca6..3e66d41 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -995,7 +995,6 @@ config SLABINFO
config RT_MUTEXES
boolean
- select PLIST
config BASE_SMALL
int
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index b859faf..c3fe932 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -114,14 +114,23 @@ static void dequeue_pushable_task(struct rq *rq, struct task_struct *p)
#else
+static inline void enqueue_pushable_task(struct rq *rq, struct task_struct *p)
+{
+}
+
+static inline void dequeue_pushable_task(struct rq *rq, struct task_struct *p)
+{
+}
+
static inline
-void enqueue_pushable_task(struct rq *rq, struct task_struct *p) {}
-static inline
-void dequeue_pushable_task(struct rq *rq, struct task_struct *p) {}
-static inline
-void inc_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) {}
+void inc_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
+{
+}
+
static inline
-void dec_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) {}
+void dec_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
+{
+}
#endif /* CONFIG_SMP */
diff --git a/lib/Kconfig b/lib/Kconfig
index 03c2c24..fc8ea1c 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -136,12 +136,6 @@ config TEXTSEARCH_BM
config TEXTSEARCH_FSM
tristate
-#
-# plist support is select#ed if needed
-#
-config PLIST
- boolean
-
config HAS_IOMEM
boolean
depends on !NO_IOMEM
diff --git a/lib/Makefile b/lib/Makefile
index 32b0e64..902d738 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -11,7 +11,8 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
rbtree.o radix-tree.o dump_stack.o \
idr.o int_sqrt.o extable.o prio_tree.o \
sha1.o irq_regs.o reciprocal_div.o argv_split.o \
- proportions.o prio_heap.o ratelimit.o show_mem.o is_single_threaded.o
+ proportions.o prio_heap.o ratelimit.o show_mem.o \
+ is_single_threaded.o plist.o
...applied it in the form below - thanks Peter! Also, tip/sched/rt is now
integrated into tip/master again.
Ingo
----------->
From ceacc2c1c85ac498ca4cf297bdfe5b4aaa9fd0e0 Mon Sep 17 00:00:00 2001
From: Peter Zijlstra <peterz@infradead.org>
Date: Fri, 16 Jan 2009 14:46:40 +0100
Subject: [PATCH] sched: make plist a library facility
Eliminate the plist library kconfig and make it available
unconditionally.
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
init/Kconfig | 1 -
kernel/sched_rt.c | 21 +++++++++++++++------
lib/Kconfig | 6 ------
lib/Makefile | 4 ++--
4 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/init/Kconfig b/init/Kconfig
index a724a14..19b78aa 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -874,7 +874,6 @@ config SLABINFO
config RT_MUTEXES
boolean
- select PLIST
config BASE_SMALL
int
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 4230b15..48d1f6e 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -114,14 +114,23 @@ static void dequeue_pushable_task(struct rq *rq, struct task_struct *p)
#else
+static inline void enqueue_pushable_task(struct rq *rq, struct task_struct *p)
+{
+}
+
+static inline void dequeue_pushable_task(struct rq *rq, struct task_struct *p)
+{
+}
+
static inline
-void enqueue_pushable_task(struct rq *rq, struct task_struct *p) {}
-static inline
-void dequeue_pushable_task(struct rq *rq, struct task_struct *p) {}
-static inline
-void inc_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) {}
+void inc_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
+{
+}
+
static inline
-void dec_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) {}
+void dec_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
+{
+}
#endif /* CONFIG_SMP */
diff --git a/lib/Kconfig b/lib/Kconfig
index 03c2c24..fc8ea1c 100644
--- ...| Greg KH | Og dreams of kernels |
| Jens Axboe | [PATCH 31/33] Fusion: sg chaining support |
| Arnd Bergmann | Re: finding your own dead "CONFIG_" variables |
| Mark Brown | [PATCH 2/2] Subject: natsemi: Allow users to disable workaround for DspCfg reset |
| Tony Breeds | [LGUEST] Look in object dir for .config |
git: | |
| Brian Downing | Re: Git in a Nutshell guide |
| John Benes | Re: master has some toys |
| Matthias Lederhofer | [PATCH 4/7] introduce GIT_WORK_TREE to specify the work tree |
| Al |
