Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Nov 2014 00:35:02 +0100
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        John-Mark Gurney <jmg@funkthat.com>, freebsd-arch@freebsd.org
Subject:   Re: refcount_release_take_##lock
Message-ID:  <20141031233502.GB20591@dft-labs.eu>
In-Reply-To: <20141028193404.GB12014@dft-labs.eu>
References:  <20141025184448.GA19066@dft-labs.eu> <201410281154.54581.jhb@freebsd.org> <20141028174428.GA12014@dft-labs.eu> <201410281413.58414.jhb@freebsd.org> <20141028193404.GB12014@dft-labs.eu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 28, 2014 at 08:34:04PM +0100, Mateusz Guzik wrote:
> On Tue, Oct 28, 2014 at 02:13:58PM -0400, John Baldwin wrote:
> > On Tuesday, October 28, 2014 1:44:28 pm Mateusz Guzik wrote:
> > > diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
> > > index f8ae0e6..e94ccde 100644
> > > --- a/sys/kern/kern_jail.c
> > > +++ b/sys/kern/kern_jail.c
> > 
> > The diff looks good to me.  Just need to update refcount.9 as well.
> > 
> 

Ping? Is this diff ok?

> diff --git a/share/man/man9/refcount.9 b/share/man/man9/refcount.9
> index e7702a2..61b9b51 100644
> --- a/share/man/man9/refcount.9
> +++ b/share/man/man9/refcount.9
> @@ -26,7 +26,7 @@
>  .\"
>  .\" $FreeBSD$
>  .\"
> -.Dd January 20, 2009
> +.Dd October 28, 2014
>  .Dt REFCOUNT 9
>  .Os
>  .Sh NAME
> @@ -44,6 +44,15 @@
>  .Fn refcount_acquire "volatile u_int *count"
>  .Ft int
>  .Fn refcount_release "volatile u_int *count"
> +.In sys/mutex.h
> +.Fn refcount_release_lock_mtx "volatile u_int *count, struct mtx *lock"
> +.In sys/rmlock.h
> +.Fn refcount_release_lock_rmlock "volatile u_int *count, struct rmlock *lock"
> +.In sys/rwlock.h
> +.Fn refcount_release_lock_rwlock "volatile u_int *count, struct rwlock *lock"
> +.In sys/lock.h
> +.In sys/sx.h
> +.Fn refcount_release_lock_sx "volatile u_int *count, struct sx *lock"
>  .Sh DESCRIPTION
>  The
>  .Nm
> @@ -77,6 +86,13 @@ The function returns a non-zero value if the reference being released was
>  the last reference;
>  otherwise, it returns zero.
>  .Pp
> +.Fn refcount_release_lock_*
> +functions release an existing reference holding the lock if it is the last
> +reference.
> +These functions return with the lock held and a non-zero value if the reference
> +being released was the last reference;
> +otherwise, they returns zero and the lock is not held.
> +.Pp
>  Note that these routines do not provide any inter-CPU synchronization,
>  data protection,
>  or memory ordering guarantees except for managing the counter.
> @@ -91,6 +107,18 @@ The
>  .Nm refcount_release
>  function returns non-zero when releasing the last reference and zero when
>  releasing any other reference.
> +.Pp
> +.Nm refcount_release_lock_*
> +functions return with the lock held and non-zero value when releasing the last
> +reference, zero without the lock held when releasing any other reference.
>  .Sh HISTORY
> -These functions were introduced in
> +.Fn refcount_init ,
> +.Fn refcount_acquire
> +and
> +.Fn refcount_release
> +functions were introduced in
>  .Fx 6.0 .
> +.Pp
> +.Fn refcount_release_lock_*
> +functions were introduced in
> +.Fx 10.2 .
> 
> -- 
> Mateusz Guzik <mjguzik gmail.com>

-- 
Mateusz Guzik <mjguzik gmail.com>



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