svn commit: r215675 - head/sys/compat/linux

John Baldwin jhb at freebsd.org
Mon Nov 22 15:30:00 UTC 2010


On Monday, November 22, 2010 7:51:06 am Kostik Belousov wrote:
> On Mon, Nov 22, 2010 at 12:42:32PM +0000, Alexander Leidinger wrote:
> > Author: netchild
> > Date: Mon Nov 22 12:42:32 2010
> > New Revision: 215675
> > URL: http://svn.freebsd.org/changeset/base/215675
> > 
> > Log:
> >   Do not take the process lock. The assignment to u_short inside the
> >   properly aligned structure is atomic on all supported architectures, and
> >   the thread that should see side-effect of assignment is the same thread
> >   that does assignment.
> >   
> >   Use a more appropriate conditional to detect the linux ABI.
> >   
> >   Suggested by:	kib
> >   X-MFC:		together with r215664
> > 
> > Modified:
> >   head/sys/compat/linux/linux_emul.c
> > 
> > Modified: head/sys/compat/linux/linux_emul.c
> > ==============================================================================
> > --- head/sys/compat/linux/linux_emul.c	Mon Nov 22 12:33:48 2010	(r215674)
> > +++ head/sys/compat/linux/linux_emul.c	Mon Nov 22 12:42:32 2010	(r215675)
> > @@ -265,7 +262,8 @@ linux_proc_exec(void *arg __unused, stru
> >  	if (__predict_false(imgp->sysent == &elf_linux_sysvec
> >  	    && p->p_sysent != &elf_linux_sysvec))
> >  		linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0);
> > -	if (__predict_false(p->p_sysent == &elf_linux_sysvec))
> > +	if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) ==
> > +	    SV_ABI_LINUX))
> >  		/* Kill threads regardless of imgp->sysent value */
> >  		linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL);
> >  	if (__predict_false(imgp->sysent != &elf_linux_sysvec
> There are several similar comparisons around the patched one.
> 
> I am still quite curious for the reason of all __predict() obfuscations
> that are countless in the linuxolator. We are not oblidged to emulate
> this aspect of Linux.

I think we should only have __predict() obfuscation if there is a benchmark
showing an indisputable performance gain.  Otherwise it is just cruft making
the code hard to read.  I suspect that a Linux app calling execve() is not a
sufficient critical path to warrant any of these.

-- 
John Baldwin


More information about the svn-src-all mailing list