Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jun 2013 09:42:40 -0500
From:      Nathan Whitehorn <nwhitehorn@freebsd.org>
To:        Ed Schouten <ed@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r251803 - head/sys/kern
Message-ID:  <51BDCEE0.8050000@freebsd.org>
In-Reply-To: <201306160930.r5G9UZfE059294@svn.freebsd.org>
References:  <201306160930.r5G9UZfE059294@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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