Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 1 | /* |
Willy Tarreau | cc05fba | 2009-10-27 21:40:18 +0100 | [diff] [blame] | 2 | * include/common/config.h |
| 3 | * This files contains most of the user-configurable settings. |
| 4 | * |
| 5 | * Copyright (C) 2000-2009 Willy Tarreau - w@1wt.eu |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation, version 2.1 |
| 10 | * exclusively. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 21 | |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 22 | #ifndef _COMMON_CONFIG_H |
| 23 | #define _COMMON_CONFIG_H |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 24 | |
Willy Tarreau | cc05fba | 2009-10-27 21:40:18 +0100 | [diff] [blame] | 25 | #include <common/compiler.h> |
Willy Tarreau | 65d805f | 2014-07-15 18:05:58 +0200 | [diff] [blame] | 26 | #include <common/compat.h> |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 27 | #include <common/defaults.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 28 | |
Willy Tarreau | e3ba5f0 | 2006-06-29 18:54:54 +0200 | [diff] [blame] | 29 | /* CONFIG_HAP_MEM_OPTIM |
| 30 | * This enables use of memory pools instead of malloc()/free(). There |
| 31 | * is no reason to disable it, except perhaps for rare debugging. |
| 32 | */ |
| 33 | #ifndef CONFIG_HAP_NO_MEM_OPTIM |
| 34 | # define CONFIG_HAP_MEM_OPTIM |
| 35 | #endif /* CONFIG_HAP_NO_MEM_OPTIM */ |
| 36 | |
Christopher Faulet | e9bd686 | 2017-08-29 09:51:52 +0200 | [diff] [blame] | 37 | #ifdef USE_THREAD |
| 38 | #define THREAD_LOCAL __thread |
| 39 | #else |
| 40 | #define THREAD_LOCAL |
| 41 | #endif |
| 42 | |
Willy Tarreau | 2325d8a | 2018-10-10 18:29:23 +0200 | [diff] [blame] | 43 | /* Some architectures have a double-word CAS, sometimes even dual-8 bytes */ |
| 44 | #if defined(__x86_64__) || defined (__aarch64__) |
| 45 | #define HA_HAVE_CAS_DW |
| 46 | #define HA_CAS_IS_8B |
| 47 | #elif defined(__arm__) && (defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__)) |
| 48 | #define HA_HAVE_CAS_DW |
| 49 | #endif |
| 50 | |
Willy Tarreau | f161d0f | 2018-02-22 14:05:55 +0100 | [diff] [blame] | 51 | /* On architectures supporting threads and double-word CAS, we can implement |
| 52 | * lock-less memory pools. This isn't supported for debugging modes however. |
| 53 | */ |
Olivier Houchard | dc21ff7 | 2019-01-29 15:20:16 +0100 | [diff] [blame] | 54 | #if defined(USE_THREAD) && defined(HA_HAVE_CAS_DW) && !defined(DEBUG_NO_LOCKLESS_POOLS) && !defined(DEBUG_UAF) && !defined(DEBUG_FAIL_ALLOC) |
Willy Tarreau | f161d0f | 2018-02-22 14:05:55 +0100 | [diff] [blame] | 55 | #define CONFIG_HAP_LOCKLESS_POOLS |
Willy Tarreau | e18db9e | 2018-10-16 10:28:54 +0200 | [diff] [blame] | 56 | #ifndef CONFIG_HAP_POOL_CACHE_SIZE |
| 57 | #define CONFIG_HAP_POOL_CACHE_SIZE 524288 |
| 58 | #endif |
Willy Tarreau | f161d0f | 2018-02-22 14:05:55 +0100 | [diff] [blame] | 59 | #endif |
| 60 | |
Willy Tarreau | 2a42950 | 2006-10-15 14:52:29 +0200 | [diff] [blame] | 61 | /* CONFIG_HAP_INLINE_FD_SET |
| 62 | * This makes use of inline FD_* macros instead of calling equivalent |
| 63 | * functions. Benchmarks on a Pentium-M show that using functions is |
| 64 | * generally twice as fast. So it's better to keep this option unset. |
| 65 | */ |
| 66 | //#undef CONFIG_HAP_INLINE_FD_SET |
| 67 | |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 68 | #endif /* _COMMON_CONFIG_H */ |