svn commit: r251803 - head/sys/kern

Nathan Whitehorn nwhitehorn at freebsd.org
Sun Jun 16 14:43:04 UTC 2013


On 06/16/13 04:30, Ed Schouten wrote:
> Author: ed
> Date: Sun Jun 16 09:30:35 2013
> New Revision: 251803
> URL: http://svnweb.freebsd.org/changeset/base/251803
>
> Log:
>    Change callout use counter to use C11 atomics.
>    
>    In order to get some coverage of C11 atomics in kernelspace, switch at
>    least one piece of code in kernelspace to use C11 atomics instead of
>    <machine/atomic.h>.
>    
>    While there, slightly improve the code by adding an assertion to prevent
>    the use count from going negative.

I'm a little worried about these kinds of changes from a performance 
standpoint when using GCC 4.2. In particular, from the GCC manual: "In 
most cases, these builtins are considered a full barrier." This is much 
more synchronization that many of the atomic ops in machine/atomic.h 
actually require. I'm worried this could lead to serious performance 
regressions on e.g. PowerPC. gcc mostly seems to do the right thing, but 
I'm not completely sure and it probably needs extensive testing. One way 
to accomplish that could be to implement atomic(9) in terms of 
stdatomic. If nothing breaks or becomes slow, then we will know we are 
in the clear permanently.
-Nathan


More information about the svn-src-head mailing list