Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Nov 2017 04:36:21 +0100
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Mark Johnston <markj@freebsd.org>
Cc:        Mateusz Guzik <mjg@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r325721 - in head/sys: kern sys
Message-ID:  <CAGudoHHdP64c0cY2aQzs-ooYBzStYHmQpOmqUfdWQoqLy-foqg@mail.gmail.com>
In-Reply-To: <20171112043244.GA1266@bish>
References:  <201711111804.vABI4e6H038060@repo.freebsd.org> <20171112043244.GA1266@bish>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 12, 2017 at 5:32 AM, Mark Johnston <markj@freebsd.org> wrote:

> On Sat, Nov 11, 2017 at 06:04:40PM +0000, Mateusz Guzik wrote:
> > Author: mjg
> > Date: Sat Nov 11 18:04:39 2017
> > New Revision: 325721
> > URL: https://svnweb.freebsd.org/changeset/base/325721
> >
> > Log:
> >   Add pfind_any
> >
> >   It looks for both regular and zombie processes. This avoids allproc
> relocking
> >   previously seen with pfind -> zpfind calls.
> >
> > +/*
> > + * Same as pfind but allow zombies.
> > + */
> > +struct proc *
> > +pfind_any(pid_t pid)
> > +{
> > +     struct proc *p;
> > +
> > +     sx_slock(&allproc_lock);
> > +     p = pfind_locked(pid);
> > +     if (p == NULL)
> > +             p = zpfind_locked(pid);
> > +     sx_sunlock(&allproc_lock);
> > +
> > +     return (p);
> > +}
>
> Can't this be written as pget(pid, 0, &p)?
>

It can, but at the expense of avoidable branch-fest. pget is rarely called
in comparison
anyway.

-- 
Mateusz Guzik <mjguzik gmail.com>



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