LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: scheduler: IRQs disabled over context switches
Date: Sun, 23 May 2004 20:38:14 +0100	[thread overview]
Message-ID: <20040523203814.C21153@flint.arm.linux.org.uk> (raw)
In-Reply-To: <Pine.LNX.4.58.0405231125420.512@bigblue.dev.mdolabs.com>; from davidel@xmailserver.org on Sun, May 23, 2004 at 11:59:01AM -0700

On Sun, May 23, 2004 at 11:59:01AM -0700, Davide Libenzi wrote:
> On Sun, 23 May 2004, Russell King wrote:
> 
> > The 2.6.6 scheduler disables IRQs across context switches, which is
> > bad news for IRQ latency on ARM - to the point where 16550A FIFO
> > UARTs to overrun.
> > 
> > I'm considering defining prepare_arch_switch & co as follows on ARM,
> > so that we release IRQs over the call to context_switch().
> > 
> > #define prepare_arch_switch(rq,next)		\
> > do {						\
> > 	spin_lock(&(next)->switch_lock);	\
> > 	spin_unlock_irq(&(rq)->lock);		\
> > } while (0)
> > #define finish_arch_switch(rq,prev)		\
> > 	spin_unlock(&(prev)->switch_lock)
> > #define task_running(rq,p)			\
> > 	((rq)->curr == (p) || spin_is_locked(&(p)->switch_lock))
> > 
> > The question is... why are we keeping IRQs disabled over context_switch()
> > in the first case?  Looking at the code, the only thing which is touched
> > outside of the two tasks is rq->prev_mm.  Since runqueues are CPU-
> > specific and we're holding at least one spinlock, I think the above
> > is preempt safe and SMP safe.
> 
> Other archs already do the above.

Not quite - look harder.  They use spin_unlock_irq in finish_arch_switch
rather than prepare_arch_switch.

Ralf Baechle mentioned that he thinks the above on MIPS causes some
rare but weird problems, though he wasn't able to give anything
specific at the time.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

  reply	other threads:[~2004-05-23 19:38 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 [this message]
2004-05-23 23:04     ` Davide Libenzi
2004-05-23 23:33       ` Russell King
2004-05-24  0:27         ` Davide Libenzi
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=20040523203814.C21153@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    --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).