Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Jun Sun <jsun@mvista.com>
To: justinca@cs.cmu.edu
Cc: linux-mips@linux-mips.org, jsun@mvista.com
Subject: Re: [RFC] FPU context switch
Date: Tue, 17 Sep 2002 11:48:31 -0700	[thread overview]
Message-ID: <20020917114831.G17321@mvista.com> (raw)
In-Reply-To: <1032288140.28433.165.camel@gs256.sp.cs.cmu.edu>; from justinca@cs.cmu.edu on Tue, Sep 17, 2002 at 02:42:20PM -0400

On Tue, Sep 17, 2002 at 02:42:20PM -0400, justinca@cs.cmu.edu wrote:
> > 
> > This requires each CPU to remember the last owner of FPU.
> > In order to support possible process migration cases in a SMP
> > system, each process also needs to remember the processor
> > on which it used FPU last.  A process has a valid live FPU
> > context on a CPU if those two variables match to each other.
> > Therefore we can avoid unnecessary restoring FPU context.
> > 
> > Fairly complex in implementation. 
> > 
> 
> I'd argue for something between 2 & 3.  Always save FPU state, and if
> you know the state has been preserved for the next run, skip the
> restore.
> 

Determining whether the current FPU context is valid for the new
process is not easy.  It requires last_task_used_math like variable
for each CPU.

> I'm a bit leery of the whole "don't restore FPU state on context switch
> until you use the FPU again" idea as it's added complexity 

Quite easy to implement.  Just turn off ST0_CU1 bit in the status register
saved in the kernel stack when a process is switched off.  Therefore
next use of FPU will cause a trap and do_cpu() does the normal thing.

> and I'm not
> at all sure you're going to see any measurable performance gain out of
> it.  

I think this gives a big performance improvement because most processes
don't use FPU during their runs but they all have used_math flag set!


Jun

  reply	other threads:[~2002-09-17 19:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-17 18:04 [RFC] FPU context switch Jun Sun
2002-09-17 18:31 ` Greg Lindahl
2002-09-17 18:35   ` Jun Sun
2002-09-17 18:42 ` justinca
2002-09-17 18:48   ` Jun Sun [this message]
2002-09-17 19:03     ` Greg Lindahl
2002-09-17 19:38       ` Daniel Jacobowitz
2002-09-17 21:44 ` Dominic Sweetman
2002-09-17 21:58   ` Matthew Dharm
2002-09-17 21:58     ` Matthew Dharm
2002-09-17 22:30     ` Kevin D. Kissell
2002-09-17 22:30       ` Kevin D. Kissell
2002-09-17 22:58       ` Greg Lindahl
2002-09-17 23:03         ` Jun Sun
2002-09-17 23:44 ` Kevin D. Kissell
2002-09-17 23:44   ` Kevin D. Kissell
2002-09-17 23:45   ` Jun Sun
2002-09-18  8:38     ` Kevin D. Kissell
2002-09-18  8:38       ` Kevin D. Kissell
2002-09-18 16:53       ` Jun Sun
2002-09-18  8:29 ` Carsten Langgaard

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=20020917114831.G17321@mvista.com \
    --to=jsun@mvista.com \
    --cc=justinca@cs.cmu.edu \
    --cc=linux-mips@linux-mips.org \
    /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