All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>
Subject: Re: v2.6.26-rc7: BUG task_struct: Poison overwritten
Date: Mon, 23 Jun 2008 15:46:32 +0400	[thread overview]
Message-ID: <20080623114632.GA173@tv-sign.ru> (raw)
In-Reply-To: <19f34abd0806211557v6763bd3fo2d99d4f26cb0d3a5@mail.gmail.com>

On 06/22, Vegard Nossum wrote:
>
> I was poking around in kernel/sched.c and noticed something odd: In
> migrate_dead(), we have this code:
>
>         /*
>          * Drop lock around migration; if someone else moves it,
>          * that's OK. No task can be added to this CPU, so iteration is
>          * fine.
>          */
>         spin_unlock_irq(&rq->lock);
>         move_task_off_dead_cpu(dead_cpu, p);
>         spin_lock_irq(&rq->lock);
>
> which is fine in itself, I guess. But spin_unlock_irq() will enable
> interrupts. And move_task_off_dead_cpu() has this comment:
>
> /*
>  * Figure out where task on dead CPU should go, use force if necessary.
>  * NOTE: interrupts should be disabled by the caller
>  */
> static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)
> {
>
> ...but here, interrupts will not be disabled. On the other hand
> __migrate_task_irq() (called by move_task_off_dead_cpu()) calls
> local_irq_disable() itself... What do you think of this? Is the
> comment wrong? Or is there a difference between "interrupts" and
> "local_irq"?

Yes, the comment is wrong, thanks.

It wasn't updated by

"do CPU_DEAD migrating under read_lock(tasklist) instead of write_lock_irq(tasklist)"
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f7b4cddcc5aca03e80e357360c9424dfba5056c2

Previously move_task_off_dead_cpu() was called under write_lock_irq(tasklist),
and we can't take tasklist for writing without disabling irqs.

If you don't see other problems, could you make a patch to fix the comment?

Oleg.


  reply	other threads:[~2008-06-23 11:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-21 19:24 v2.6.26-rc7: BUG task_struct: Poison overwritten Vegard Nossum
2008-06-21 19:28 ` Vegard Nossum
2008-06-21 20:41   ` Vegard Nossum
2008-06-21 21:21     ` Peter Zijlstra
2008-06-21 22:57       ` Vegard Nossum
2008-06-23 11:46         ` Oleg Nesterov [this message]
2008-06-22  7:55     ` Vegard Nossum

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=20080623114632.GA173@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@cs.helsinki.fi \
    --cc=vegard.nossum@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.