mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Dmitry Adamushko <dmitry.adamushko@gmail.com>,
	miaox@cn.fujitsu.com, Lai Jiangshan <laijs@cn.fujitsu.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Avi Kivity <avi@qumranet.com>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [BUG] CFS vs cpu hotplug
Date: Thu, 10 Jul 2008 09:39:38 +0200	[thread overview]
Message-ID: <20080710073938.GB21543@elte.hu> (raw)
In-Reply-To: <20080710073055.GA7127@osiris.boeblingen.de.ibm.com>


* Heiko Carstens <heiko.carstens@de.ibm.com> wrote:

> > Subject: sched: prevent a potentially endless loop in 
> > move_task_off_dead_cpu()
> > 
> > Interrupts are enabled on other CPUs when migration_call(CPU_DEAD, 
> > ...) is called so we may get a race between try_to_wake_up() and 
> > migrate_live_tasks() -> move_task_off_dead_cpu(). The former one may 
> > push a task out of a dead CPU causing the later one to loop 
> > endlessly.
> 
> That's exactly what explains a dump I got yesterday. Thanks for 
> fixing! :)

applied to tip/sched/urgent via the commit below - lets see whether we 
can still get it into v2.6.26.

	Ingo

---------------->
commit dc7fab8b3bb388c57c6c4a43ba68c8a32ca25204
Author: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Date:   Thu Jul 10 00:32:40 2008 +0200

    sched: fix cpu hotplug
    
    I think we may have a race between try_to_wake_up() and
    migrate_live_tasks() -> move_task_off_dead_cpu() when the later one
    may end up looping endlessly.
    
    Interrupts are enabled on other CPUs when migration_call(CPU_DEAD, ...) is
    called so we may get a race between try_to_wake_up() and
    migrate_live_tasks() -> move_task_off_dead_cpu(). The former one may push
    a task out of a dead CPU causing the later one to loop endlessly.
    
    Heiko Carstens observed:
    
    | That's exactly what explains a dump I got yesterday. Thanks for fixing! :)
    
    Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com>
    Cc: miaox@cn.fujitsu.com
    Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
    Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Avi Kivity <avi@qumranet.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/kernel/sched.c b/kernel/sched.c
index 94ead43..9397b87 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5621,8 +5621,10 @@ static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu)
 
 	double_rq_lock(rq_src, rq_dest);
 	/* Already moved. */
-	if (task_cpu(p) != src_cpu)
+	if (task_cpu(p) != src_cpu) {
+		ret = 1;
 		goto out;
+	}
 	/* Affinity changed (again). */
 	if (!cpu_isset(dest_cpu, p->cpus_allowed))
 		goto out;

  reply	other threads:[~2008-07-10  7:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-09 22:32 Dmitry Adamushko
2008-07-10  7:30 ` Heiko Carstens
2008-07-10  7:39   ` Ingo Molnar [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-06-19 16:19 Heiko Carstens
2008-06-19 18:05 ` Peter Zijlstra
2008-06-19 18:14   ` Peter Zijlstra
2008-06-19 21:14     ` Heiko Carstens
2008-06-19 21:26       ` Peter Zijlstra
2008-06-19 21:17   ` Heiko Carstens
2008-06-19 21:32   ` Peter Zijlstra
2008-06-19 21:49     ` Heiko Carstens
2008-06-20  8:51       ` Peter Zijlstra
2008-06-20 22:19         ` Heiko Carstens
2008-06-20 11:44   ` Dmitry Adamushko
2008-06-20 22:23     ` Heiko Carstens
2008-06-25 22:12 ` Dmitry Adamushko
2008-06-28 22:16   ` Dmitry Adamushko
2008-06-29  6:55     ` Ingo Molnar
2008-06-30  9:07     ` Heiko Carstens
2008-06-30  9:17       ` Ingo Molnar
2008-07-01  9:22         ` Lai Jiangshan
2008-07-01  9:31           ` Ingo Molnar
2008-07-01 10:09             ` Lai Jiangshan
2008-07-02  7:13             ` Lai Jiangshan
2008-07-02  8:50               ` Dmitry Adamushko
2008-07-02  9:23                 ` Lai Jiangshan
2008-07-07 10:26                   ` Miao Xie
2008-07-07 11:31                     ` Dmitry Adamushko

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=20080710073938.GB21543@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=avi@qumranet.com \
    --cc=dmitry.adamushko@gmail.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miaox@cn.fujitsu.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

all inboxes | Powered by JetHome®