mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>, linux-kernel@vger.kernel.org
Subject: Re: Q: a bogus task_running() check in try_to_wake_up() ?
Date: Wed, 18 Jul 2007 20:35:59 +0400	[thread overview]
Message-ID: <20070718163559.GA837@tv-sign.ru> (raw)
In-Reply-To: <20070717190548.GB26283@elte.hu>

On 07/17, Ingo Molnar wrote:
> 
> * Oleg Nesterov <oleg@tv-sign.ru> wrote:
> 
> > try_to_wake_up:
> > 	
> > 	if (p->se.on_rq)
> > 		goto out_running;
> > 
> > 	...
> > 
> > 	if (unlikely(task_running(rq, p)))
> > 		goto out_activate;
> > 
> > How it possible that rq->curr has on_rq == 0 ?
> > 
> > AFAICS, this can only happen if this task is rq->idle. But idle 
> > threads should not sleep, we have a special "scheduling from the idle 
> > thread!" check in schedule().
> 
> it's also possible if an arch uses __ARCH_WANT_INTERRUPTS_ON_CTXSW, 
> right?

Ah, got it. I guess you meant __ARCH_WANT_UNLOCKED_CTXSW though.

In that case schedule() drops rq->lock before the context switch, but doesn't
clear ->oncpu. So, task_running(p) means we must not activate "p" on another
CPU, otherwise it could be scheduled before the switch-in-progress completes.

Thanks a lot!

Oleg.


      reply	other threads:[~2007-07-18 16:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-15 15:39 Oleg Nesterov
2007-07-17 19:05 ` Ingo Molnar
2007-07-18 16:35   ` Oleg Nesterov [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=20070718163559.GA837@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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®