LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Davide Libenzi <davidel@xmailserver.org>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: scheduler: IRQs disabled over context switches
Date: Sun, 23 May 2004 17:27:17 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.58.0405231635300.512@bigblue.dev.mdolabs.com> (raw)
In-Reply-To: <20040524003308.B4818@flint.arm.linux.org.uk>
On Mon, 24 May 2004, Russell King wrote:
> On Sun, May 23, 2004 at 04:04:39PM -0700, Davide Libenzi wrote:
> > On Sun, 23 May 2004, Russell King wrote:
> > > Not quite - look harder. They use spin_unlock_irq in finish_arch_switch
> > > rather than prepare_arch_switch.
> >
> > Hmm, they do indeed. Hmm, if we release the rq lock before the ctx switch,
> > "prev" (the real one) will result not running since we already set
> > "rq->curr" to "next" (and we do not hold "prev->switch_lock").
>
> We do hold prev->switch_lock - we hold it all the time that the thread
> is running. Consider what prepare_arch_switch() is doing - it's taking
> the next threads switch_lock. It only gets released _after_ we've
> switched away from that thread.
It is flawed indeed :) (/me looking at it after ages). Even looking at the
scheduler tick code, it does not play with mm fields, so it should be fine
after the rq lock (and IRQ) release. Preempt is fine due to the preempt_disable()
(plus switch_lock held), tasks result running (due switch_lock held) so
remote CPUs won't touch them, and scheduler_tick() looking innocuous with
respect to the fields that matters for switch. Is it blowing up on ARM?
- Davide
next prev parent reply other threads:[~2004-05-24 0:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-23 16:43 Russell King
2004-05-23 18:59 ` Davide Libenzi
2004-05-23 19:38 ` Russell King
2004-05-23 23:04 ` Davide Libenzi
2004-05-23 23:33 ` Russell King
2004-05-24 0:27 ` Davide Libenzi [this message]
2004-05-24 8:37 ` Ingo Molnar
2004-05-24 6:41 ` Davide Libenzi
2004-05-24 9:05 ` Ingo Molnar
2004-05-24 7:10 ` Nick Piggin
2004-05-24 9:15 ` Ingo Molnar
2004-05-24 17:16 ` Davide Libenzi
2004-05-24 17:46 ` Davide Libenzi
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=Pine.LNX.4.58.0405231635300.512@bigblue.dev.mdolabs.com \
--to=davidel@xmailserver.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+lkml@arm.linux.org.uk \
--subject='Re: scheduler: IRQs disabled over context switches' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).