mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
fix a compilation error around madvise when make with jemalloc on MacOS (#9350)
We only use MADV_DONTNEED on Linux, that's were it was tested.
This commit is contained in:
parent
8f8117f78e
commit
8ab33c18e4
@ -537,9 +537,9 @@ void dismissObject(robj *o, size_t size_hint) {
|
||||
/* madvise(MADV_DONTNEED) may not work if Transparent Huge Pages is enabled. */
|
||||
if (server.thp_enabled) return;
|
||||
|
||||
/* Currently we use zmadvise_dontneed only when we use jemalloc.
|
||||
/* Currently we use zmadvise_dontneed only when we use jemalloc with Linux.
|
||||
* so we avoid these pointless loops when they're not going to do anything. */
|
||||
#if defined(USE_JEMALLOC)
|
||||
#if defined(USE_JEMALLOC) && defined(__linux__)
|
||||
if (o->refcount != 1) return;
|
||||
switch(o->type) {
|
||||
case OBJ_STRING: dismissStringObject(o); break;
|
||||
|
@ -5987,9 +5987,9 @@ void dismissMemoryInChild(void) {
|
||||
/* madvise(MADV_DONTNEED) may not work if Transparent Huge Pages is enabled. */
|
||||
if (server.thp_enabled) return;
|
||||
|
||||
/* Currently we use zmadvise_dontneed only when we use jemalloc.
|
||||
/* Currently we use zmadvise_dontneed only when we use jemalloc with Linux.
|
||||
* so we avoid these pointless loops when they're not going to do anything. */
|
||||
#if defined(USE_JEMALLOC)
|
||||
#if defined(USE_JEMALLOC) && defined(__linux__)
|
||||
|
||||
/* Dismiss replication backlog. */
|
||||
if (server.repl_backlog != NULL) {
|
||||
|
@ -346,7 +346,7 @@ void zmalloc_set_oom_handler(void (*oom_handler)(size_t)) {
|
||||
* We do that in a fork child process to avoid CoW when the parent modifies
|
||||
* these shared pages. */
|
||||
void zmadvise_dontneed(void *ptr) {
|
||||
#if defined(USE_JEMALLOC)
|
||||
#if defined(USE_JEMALLOC) && defined(__linux__)
|
||||
static size_t page_size = 0;
|
||||
if (page_size == 0) page_size = sysconf(_SC_PAGESIZE);
|
||||
size_t page_size_mask = page_size - 1;
|
||||
|
Loading…
Reference in New Issue
Block a user