From: Bert Hubert Date: Sun, 13 Nov 2005 10:35:17 +0000 (+0000) Subject: actually make lock skipping work X-Git-Tag: pdns-2.9.20~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90a5cfe2b52e1724dc3b428d2cfc7ef427f6e5a8;p=thirdparty%2Fpdns.git actually make lock skipping work git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@550 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/recursor_cache.cc b/pdns/recursor_cache.cc index 11422b3481..d6a89a001a 100644 --- a/pdns/recursor_cache.cc +++ b/pdns/recursor_cache.cc @@ -6,9 +6,10 @@ using namespace std; using namespace boost; -#include +#include "config.h" -#ifdef GCC_SKIP_LOGGING +#ifdef GCC_SKIP_LOCKING +#include // This code is ugly but does speedup the recursor tremendously on multi-processor systems, and even has a large effect (20, 30%) on uniprocessor namespace __gnu_cxx { @@ -16,18 +17,16 @@ namespace __gnu_cxx __attribute__ ((__unused__)) __exchange_and_add(volatile _Atomic_word* __mem, int __val) { - register _Atomic_word __result; - __asm__ __volatile__ ("xadd{l} {%0,%1|%1,%0}" - : "=r" (__result), "=m" (*__mem) - : "0" (__val), "m" (*__mem)); + register _Atomic_word __result=*__mem; + *__mem+=__val; + return __result; } void __attribute__ ((__unused__)) __atomic_add(volatile _Atomic_word* __mem, int __val) { - __asm__ __volatile__ ("add{l} {%1,%0|%0,%1}" - : "=m" (*__mem) : "ir" (__val), "m" (*__mem)); + *__mem+=__val; } } #endif