diff options
author | David CARLIER <devnexen@gmail.com> | 2022-10-16 05:51:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-16 07:51:44 +0300 |
commit | 871cc200a0046ccb73a67377327c6b97b52117a1 (patch) | |
tree | 3ce4c89eb3b2672646dda57ffc1ba1ede26760b7 /src/networking.c | |
parent | 29380ff77d5da51d3065b810a9f93171f8724c1a (diff) | |
download | redis-871cc200a0046ccb73a67377327c6b97b52117a1.tar.gz |
Fixes build warning when CACHE_LINE_SIZE is already defined. (#11389)
* Fixes build warning when CACHE_LINE_SIZE is already defined
* Fixes wrong CACHE_LINE_SIZE on some FreeBSD systems where it could be set to 128 (e.g. on MIPS)
* Fixes wrong CACHE_LINE_SIZE on Apple M1 (use 128 instead of 64)
Wrong cache line size in that case can some false sharing of array elements between threads, see #10892
Diffstat (limited to 'src/networking.c')
-rw-r--r-- | src/networking.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/networking.c b/src/networking.c index 180782584..3a4dc3816 100644 --- a/src/networking.c +++ b/src/networking.c @@ -3974,7 +3974,13 @@ void processEventsWhileBlocked(void) { * ========================================================================== */ #define IO_THREADS_MAX_NUM 128 +#ifndef CACHE_LINE_SIZE +#if defined(__aarch64__) && defined(__APPLE__) +#define CACHE_LINE_SIZE 128 +#else #define CACHE_LINE_SIZE 64 +#endif +#endif typedef struct __attribute__((aligned(CACHE_LINE_SIZE))) threads_pending { redisAtomic unsigned long value; |