[strongSwan-dev] [PATCH] log: do not acquire lock if nobody is listening

Christophe Gouault christophe.gouault at 6wind.com
Thu Apr 24 18:29:02 CEST 2014


On 04/24/2014 06:23 PM, Tobias Brunner wrote:
> Hi Christoph,
>
> Thanks for testing the code.
>
>>> The check is disabled completely if these built-ins are not available,
>>> because fallbacks (like those for ref_*) would not improve the
>>> performance.  But since even the atomic implementation allows races an
>>> alternative approach would be to use __atomic* if available and just
>>> directly read and write if not (thus avoiding the __sync penalty).  We
>>> could make max_[v]level an int32_t array to be reasonably safe.
>>
>> This sounds reasonable to simply read and write when atomic macros are
>> not available. I may be wrong, but I think that modern processors always
>> read or write an int32_t atomically, provided it is aligned on a 32 bit
>> boundary.
>
> I think so too, but I feel safer not relying on assumptions :)  So I
> merged the branch as is.
>
> Regards,
> Tobias
>

Hi Tobias,

Great, thanks!
Christophe


More information about the Dev mailing list