Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Aug 2003 15:22:37 -0400 (EDT)
From:      Daniel Eischen <eischen@vigrid.com>
To:        "Portante, Peter" <peter.portante@hp.com>
Cc:        Marcel Moolenaar <marcel@xcllnt.net>
Subject:   RE: Atomic swap
Message-ID:  <Pine.GSO.4.10.10308071517360.29641-100000@pcnet5.pcnet.com>
In-Reply-To: <B24FABB430F7C94D942D6386447C93DC0512B561@tayexc17.americas.cpqcorp.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 7 Aug 2003, Portante, Peter wrote:

> Dan,
> 
> > ----------
> > From: 	Daniel Eischen
> > Reply To: 	deischen@freebsd.org
> > Sent: 	Thursday, August 7, 2003 3:05 PM
> > To: 	Marcel Moolenaar
> > Cc: 	Portante, Peter; alpha@freebsd.org; deischen@freebsd.org
> > Subject: 	Re: Atomic swap
> > 
> > On Thu, 7 Aug 2003, Marcel Moolenaar wrote:
> > 
> > > static __inline void
> > > atomic_swap_long(volatile long *dst, long val, long *res)
> > > {
> > > 	__asm (	"1: ldq_l   t0,%0\n"
> > > 		"   mov     %1,t1\n"
> > 
> > If I swap the first 2 instructions:
> > 
> > 	__asm ( "1: mov     %1,t1\n"
> > 		    ldq_l   t0,%0\n"
> > 
> > that eliminates 1 instruction from between the locked
> > instructions.  Is there anything wrong with doing that?
> > 
> Actually, the processor has a chance to do something while waiting for
> memory, so it does not hurt to have the mov inside the ldq_l/stq_c pair.

I'm just thinking that it could narrow the window in which
you can get a contention, but if the window is the same
regardless of the order of those 2 instructions, then
that's OK.

-- 
Dan Eischen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10308071517360.29641-100000>