Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Apr 2003 14:24:44 -0500
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        Peter Wemm <peter@wemm.org>
Cc:        Nate Lawson <nate@root.org>
Subject:   Re: cvs commit: src/sys/conf options.i386 src/sys/i386/i386 machdep.c mp_machdep.c pmap.c swtch.s src/sys/i386/include md_var.h pmap.h smp.h src/sys/i386/isa apic_vector.s intr_machdep.h src/sys/kern kern_switch.c kern_synch.c kern_thr.c kern_thread.c subr_witness.c ...
Message-ID:  <20030403142444.A32536@grasshopper.cs.duke.edu>
In-Reply-To: <20030403012341.B55B32A8A7@canning.wemm.org>; from peter@wemm.org on Wed, Apr 02, 2003 at 05:23:41PM -0800
References:  <Pine.BSF.4.21.0304021706050.12767-100000@root.org> <20030403012341.B55B32A8A7@canning.wemm.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Peter Wemm [peter@wemm.org] wrote:
> Nate Lawson wrote:
<..>
> > Shouldn't there be a "if (thread == curthread) return;" in the scheduling
> > code somewhere?
> 
> There is now. :-)
> 
>         newtd = choosethread();
>         if (td != newtd)
>                 cpu_switch(td, newtd);  /* SHAZAM!! */
> #ifdef SWTCH_OPTIM_STATS
>         else
>                 stupid_switch++;
> #endif
> 
> sparc64's cpu_switch() already optimized this case.  i386 didn't.  I haven't
> checked alpha/ia64 yet, but they're still using the old no-args API.

I think alpha has this feature:

LEAF(cpu_switch, 1)
<..>
        CALL(choosethread)                      /* can't return NULL */
        mov     v0, s2                          /* s2 = new thread  */
        ldq     s3, TD_MD_PCBPADDR(s2)          /* s3 = new pcbpaddr */

        /*
         * Check to see if we're switching to ourself.  If we are,
         * don't bother loading the new context.
<..>

        cmpeq   s0, s2, t0                      /* oldthread == newthread? */
        bne     t0, Lcs7                        /* Yes!  Skip! */

Drew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030403142444.A32536>