Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Oct 2000 18:46:00 -0700
From:      Alfred Perlstein <bright@wintelcom.net>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Matt Dillon <dillon@earth.backplane.com>, Peter Wemm <peter@netplex.com.au>, Chuck Paterson <cp@bsdi.com>, John Baldwin <jhb@FreeBSD.ORG>, arch@FreeBSD.ORG, John Polstra <jdp@polstra.com>, Daniel Eischen <eischen@vigrid.com>, Greg Lehey <grog@lemis.com>
Subject:   Re: Mutexes and semaphores
Message-ID:  <20001004184559.Q27736@fw.wintelcom.net>
In-Reply-To: <Pine.BSF.4.21.0010051216130.12069-100000@besplex.bde.org>; from bde@zeta.org.au on Thu, Oct 05, 2000 at 12:40:16PM %2B1100
References:  <200010041639.e94GdVR24384@earth.backplane.com> <Pine.BSF.4.21.0010051216130.12069-100000@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
* Bruce Evans <bde@zeta.org.au> [001004 18:40] wrote:
> On Wed, 4 Oct 2000, Matt Dillon wrote:
> 
> [Writing reordered to reply after quoted material]
> 
> [Peter Wemm wrote]
> 
> > :int
> > :getppid(p, uap)
> > :	struct proc *p;
> > :	struct getppid_args *uap;
> > :{
> > :	struct proc *parent;
> > :	pid_t pid;
> > :
> > :	parent = p->p_pptr;
> > :	pid = parent->p_pid;
> > :#ifdef SMP
> > :	for (;;) {
> > :		__asm __volatile (": : : memory");	/* mb(); on x86 */
> > :		if (parent == p->p_pptr)
> > :			break;
> > :		/* lost a race, our parent died and we reparented - redo */
> > :		parent = p->p_pptr;
> > :		pid = parent->p_pid;
> > :	}		
> > :#endif
> > :	p->p_retval[0] = (register_t)pid;
> > :	return 0;
> > :}
> 
> >     This is one of the few things I really hate in the linux source base.
> 
> This seems to be only to win getppid() benchmarks.  Complications like it
> might be justified in inner loops of syscalls that are called somewhat
> more than once at most in normal programs.  It's too hard to do things
> this in the thousands of places that would be necessary to get a uniform
> speedup.

the idea is to reduce inter-cpu communication, lock-less systems are a
terrific idea but hard to get right, we have two choices:

1) do it right and _not_ cause extra lock/cpu/bus contention
2) do it right and cause extra lock/cpu/bus contention

It's my opinion that something simple like getpid shouldn't cause a
locked bus cycle if at all possible.

-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."


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




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