From: Ingo Molnar <mingo@elte.hu>
To: Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Cc: tglx@linutronix.de,
Michal Piotrowski <michal.k.k.piotrowski@googlemail.com>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [patch] sched: fix SMT scheduler bug
Date: Mon, 26 Feb 2007 14:25:15 +0100 [thread overview]
Message-ID: <20070226132515.GA17601@elte.hu> (raw)
In-Reply-To: <6bffcb0e0702260501q214c3ac8xedee578e4e29a5be@mail.gmail.com>
* Michal Piotrowski <michal.k.k.piotrowski@gmail.com> wrote:
> Ok, I think that this is a SMT scheduler problem.
>
> System works fine for fifteen hours.
hmmm. I think it's this piece of smt-nice code in sched.c:
if (dependent_sleeper(cpu, rq, next))
next = rq->idle;
this will skip to run this HT CPU if the sibling CPU is running a task
that is more important. And dependent_sleeper() doesnt skip kernel
threads such as ksoftirqd:
/* kernel/rt threads do not participate in dependent sleeping */
if (!p->mm || rt_task(p))
return 0;
but ... what if the highest-prio thread is a user-space task /and/ there
is ksoftirqd also queued, which is now delayed? We schedule the idle
task instead of processing softirqs. Ouch!
To test this theory, could you turn the SMT scheduler back on but also
apply the patch below. Does it still work fine?
Ingo
---------------------->
Subject: [patch] sched: fix SMT scheduler bug
From: Ingo Molnar <mingo@elte.hu>
the SMT scheduler incorrectly skips kernel threads even if they
are runnable (but they are preempted by a higher-prio user-space
task which got SMT-delayed by an even higher-priority task
running on a sibling CPU).
fix this for now by only doing the SMT-nice optimization if
the to-be-delayed task is the only runnable task. (This should
cover most of the real-life cases anyway.)
this bug has been in the SMT scheduler since 2.6.17 or so, but has
only been noticed now by the active check in the dynticks code.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/sched.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -3537,7 +3537,7 @@ need_resched_nonpreemptible:
}
}
next->sleep_type = SLEEP_NORMAL;
- if (dependent_sleeper(cpu, rq, next))
+ if (rq->nr_running == 1 && dependent_sleeper(cpu, rq, next))
next = rq->idle;
switch_tasks:
if (next == rq->idle)
prev parent reply other threads:[~2007-02-26 13:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-20 18:54 2.6.20-git15 BUG: soft lockup detected on CPU#0! - timers? Michal Piotrowski
2007-02-20 21:56 ` Thomas Gleixner
2007-02-20 22:37 ` Michal Piotrowski
2007-02-21 15:33 ` Thomas Gleixner
2007-02-21 15:38 ` Michal Piotrowski
2007-02-21 20:00 ` Thomas Gleixner
2007-02-22 1:47 ` Michal Piotrowski
2007-02-22 10:50 ` Michal Piotrowski
2007-02-23 6:08 ` Ingo Molnar
2007-02-23 7:32 ` Mike Galbraith
2007-02-23 10:10 ` Ingo Molnar
2007-02-24 22:45 ` Michal Piotrowski
2007-02-25 9:53 ` Thomas Gleixner
2007-02-26 13:01 ` Michal Piotrowski
2007-02-26 13:25 ` Ingo Molnar [this message]
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=20070226132515.GA17601@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.k.k.piotrowski@gmail.com \
--cc=michal.k.k.piotrowski@googlemail.com \
--cc=tglx@linutronix.de \
/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
Powered by JetHome