Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
8ab33c18
Unverified
Commit
8ab33c18
authored
Aug 10, 2021
by
DarrenJiang13
Committed by
GitHub
Aug 10, 2021
Browse files
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.
parent
8f8117f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/object.c
View file @
8ab33c18
...
...
@@ -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
;
...
...
src/server.c
View file @
8ab33c18
...
...
@@ -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
)
{
...
...
src/zmalloc.c
View file @
8ab33c18
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment