Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Dec 2011 15:08:55 +0100
From:      Ed Schouten <ed@80386.nl>
To:        John Baldwin <jhb@freebsd.org>
Cc:        freebsd-fs@freebsd.org, pjd@freebsd.org
Subject:   Re: Changing refcount(9) to use a refcount_t
Message-ID:  <20111223140855.GB1771@hoeg.nl>
In-Reply-To: <201112230834.08198.jhb@freebsd.org>
References:  <20111222214728.GV1771@hoeg.nl> <201112230834.08198.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--X4WsLVyvVA2qFUe+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* John Baldwin <jhb@freebsd.org>, 20111223 14:34:
> Hmm, are we really aiming to replace <machine/atomic.h> with the C1X API
> instead?

That depends on the success and adoption of the API, right? If it turns
out Clang and GCC do a very good job at adopting it properly and in a
timely fashion, why stick to <machine/atomic.h>?

Looking at the specification, it doesn't seem to be that bad. Compared
to what we have in <machine/atomic.h>, it seems to support more
operations (e.g. a regular exchange, instead of our readandclear) and
practically allows any type of barrier for any operation.

> FWIW, I thought about making a refcount_t when first writing <sys/refcoun=
t.h>=20
> but bde@ talked me out of it.  Bruce is of the general opinion that we sh=
ould
> avoid adding new *_t typedefs when we can help it.

But in this case there is a valid reason why we should typedef it:
portability. It allows us to implement reference counting any way we
like. Whether it is packing it together with a mutex, using GCC inline
assembly, C1X operations, etc.

I'm not saying we should switch to C1X atomics in the nearby future, but
it wouldn't hurt to make any preparations that allow us to experiment
with it in due time.

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

--X4WsLVyvVA2qFUe+
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iQIcBAEBAgAGBQJO9It3AAoJEG5e2P40kaK7OVwP/2hgRJ0Pdfgogsk8I2h1mjOS
AGaSeiRrNyvSmO+N36Bz7wfFhmMt8vjMihol6hh//5TG+q/rq0eZuWOPqnSZXqCa
AUVpVd33/C+ikXtNMOS3aF/GNQuZyk5tJ/UdwO3x9KZzy4Rl6Mpqq5C1cbesyNW6
pW9TbX/0YN92IfYgkC770wrCqmz6aVkb8369UWwFP1agdcIFLWvU0881LKOG6dnI
9pAYqHoRtEdtH7QUlo/AQ85W5kPBtzVMemvFZvvC8YCJB4VCSrP9R7/tXCEqf2z4
DPLlN4LL84Td73L6n0jQxVYjd9iXGczwru7UNZfWqlcjx8MtSVV4RAiUogMlB+cT
6vs6b5mY9ehGm10gN9w0OdGCFdsJmwNJTIvLsIPQWZ0poqAONAVYlKvV1H9SyHKw
WGy9sbmaOead+OrCf5fD26LX4iA5Abl0d0SAJmSfdVQ90WH6ZzTG/wngzxbrzTeM
TmhmaaJDhgJWLCqbUzmF6Gm2LjEhK0PmUy/dw4eYzZjk+SdlvReqhwP5GSmErvf0
7/gJjih9Dpm0DL03025Yyht86IzjHUW7x2t54r1TTglc2imm9WnspLjaWmQ/4GHR
z7Z5DQuiymTkrHqT2jtRAhRgGz+1W9aR7Za3LlgU9+QnGIcOtH1xMtbYT9xcRQWi
n3CuapJS/HRA5IroZjyY
=f6MT
-----END PGP SIGNATURE-----

--X4WsLVyvVA2qFUe+--



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