From: Gregory Haskins <ghaskins@novell.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
LKML <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
zengzm.kernel@gmail.com
Subject: Re: [PATCH] sched_rt: fix overload bug on rt group scheduling -v2
Date: Fri, 10 Jul 2009 00:05:27 -0400 [thread overview]
Message-ID: <4A56BE07.9050104@novell.com> (raw)
In-Reply-To: <1247067476.9777.57.camel@twins>
[-- Attachment #1: Type: text/plain, Size: 3231 bytes --]
Peter Zijlstra wrote:
> Greg, how's this?
>
Hi Peter,
Sorry for the delay getting back to you.
I can't vouch specifically for the rt-group specific part, but as far as
the general balancer modifications to the migration code, it looks good.
> ---
> Subject: sched_rt: fix overload bug on rt group scheduling
> From: Peter Zijlstra <peterz@infradead.org>
> Date: Wed, 01 Apr 2009 18:40:15 +0200
>
> Fixes an easily triggerable BUG() when setting process affinities.
>
> Make sure to count the number of migratable tasks in the same place:
> the root rt_rq. Otherwise the number doesn't make sense and we'll hit
> the BUG in set_cpus_allowed_rt().
>
> Also, make sure we only count tasks, not groups (this is probably
> already taken care of by the fact that rt_se->nr_cpus_allowed will be 0
> for groups, but be more explicit)
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
>
Acked-by: Gregory Haskins <ghaskins@novell.com>
> ---
> kernel/sched_rt.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> Index: linux-2.6/kernel/sched_rt.c
> ===================================================================
> --- linux-2.6.orig/kernel/sched_rt.c
> +++ linux-2.6/kernel/sched_rt.c
> @@ -10,6 +10,8 @@ static inline struct task_struct *rt_tas
>
> #ifdef CONFIG_RT_GROUP_SCHED
>
> +#define rt_entity_is_task(rt_se) (!(rt_se)->my_q)
> +
> static inline struct rq *rq_of_rt_rq(struct rt_rq *rt_rq)
> {
> return rt_rq->rq;
> @@ -22,6 +24,8 @@ static inline struct rt_rq *rt_rq_of_se(
>
> #else /* CONFIG_RT_GROUP_SCHED */
>
> +#define rt_entity_is_task(rt_se) (1)
> +
> static inline struct rq *rq_of_rt_rq(struct rt_rq *rt_rq)
> {
> return container_of(rt_rq, struct rq, rt);
> @@ -73,7 +77,7 @@ static inline void rt_clear_overload(str
>
> static void update_rt_migration(struct rt_rq *rt_rq)
> {
> - if (rt_rq->rt_nr_migratory && (rt_rq->rt_nr_running > 1)) {
> + if (rt_rq->rt_nr_migratory && rt_rq->rt_nr_total > 1) {
> if (!rt_rq->overloaded) {
> rt_set_overload(rq_of_rt_rq(rt_rq));
> rt_rq->overloaded = 1;
> @@ -86,6 +90,12 @@ static void update_rt_migration(struct r
>
> static void inc_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
> {
> + if (!rt_entity_is_task(rt_se))
> + return;
> +
> + rt_rq = &rq_of_rt_rq(rt_rq)->rt;
> +
> + rt_rq->rt_nr_total++;
> if (rt_se->nr_cpus_allowed > 1)
> rt_rq->rt_nr_migratory++;
>
> @@ -94,6 +104,12 @@ static void inc_rt_migration(struct sche
>
> static void dec_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
> {
> + if (!rt_entity_is_task(rt_se))
> + return;
> +
> + rt_rq = &rq_of_rt_rq(rt_rq)->rt;
> +
> + rt_rq->rt_nr_total--;
> if (rt_se->nr_cpus_allowed > 1)
> rt_rq->rt_nr_migratory--;
>
> diff --git a/kernel/sched.c b/kernel/sched.c
> index fd3ac58..a07d520 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -493,6 +493,7 @@ struct rt_rq {
> #endif
> #ifdef CONFIG_SMP
> unsigned long rt_nr_migratory;
> + unsigned long rt_nr_total;
> int overloaded;
> struct plist_head pushable_tasks;
> #endif
>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 266 bytes --]
next prev parent reply other threads:[~2009-07-10 4:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-01 16:40 [PATCH] sched_rt: fix overload bug on rt group scheduling Peter Zijlstra
2009-04-02 0:58 ` Gregory Haskins
2009-04-02 6:48 ` Peter Zijlstra
2009-04-02 11:21 ` Gregory Haskins
2009-07-08 15:37 ` [PATCH] sched_rt: fix overload bug on rt group scheduling -v2 Peter Zijlstra
2009-07-08 15:54 ` Gregory Haskins
2009-07-10 4:05 ` Gregory Haskins [this message]
2009-07-10 10:41 ` [tip:sched/urgent] sched_rt: Fix overload bug on rt group scheduling tip-bot for Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A56BE07.9050104@novell.com \
--to=ghaskins@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=zengzm.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox