Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jan 2001 13:51:52 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        "Justin T. Gibbs" <gibbs@scsiguy.com>
Cc:        Peter Wemm <peter@netplex.com.au>, Poul-Henning Kamp <phk@critter.freebsd.dk>, Wilko Bulte <wkb@freebie.demon.nl>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, Bruce Evans <bde@zeta.org.au>
Subject:   Re: cvs commit: src/sys/i386/conf GENERIC
Message-ID:  <XFMail.010115135152.jhb@FreeBSD.org>
In-Reply-To: <200101152138.f0FLcLs61722@aslan.scsiguy.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 15-Jan-01 Justin T. Gibbs wrote:
>>> All that is required in the userland implementation is the setting of a
>>> flag so the userland thread scheduler does not perform a thread switch.
>>> Having an interrupt fire does not have the same consequences on a userland
>>> program as it does for the kernel.
>>
>>Actually, the process needs to not be switched.  This is part of KSE, so you
>>would have to set a kernel flag in the kse for this, but yes, that would
>>work.
>> 
>>Granted, it pessimizes the non-i386 case, but not that badly.  The kernel
>>trap
>>to emulate only pessimizes the i386 case (though the 386 could do without
>>extr
>>a pessimizations, and it is a bigger pessimization.)
> 
> I suppose I haven't read enough of the KSE stuff to understand why
> you need to not change processes (or is a process the "unit" used
> to represent a KSE?).  Doesn't the userland scheduler decide what
> to do with any KSE it is given?

KSE doesn't have a userland scheduler.  It's all in the kernel.  But yes, you
are right, it is just the KSE, and not the process switch that needs to be
prevented.

> Anyway, if you use the "patch up the atomic operation" approach, you
> don't pessimize anyone except on the first run through a particular
> atomic operation.

Actually, the easiest way I can think of to do this would be to have an 
internal cmpset() function:

int
cmpset(dst, exp, src)
{
        if (on_a_386) {
                set_no_switch_flag;
                if (*dst == exp) {
                        *dst = src;
                        return 1;
                } else
                        return 0;
        } else
                return atomic_cmpset(dst, exp, src);
}

Then change ast() in the kernel to check the per-KSE flag.

> --
> Justin

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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