Bypass the THP check for strings

This commit is contained in:
Yangbo Long 2026-05-25 11:52:22 -04:00
parent 02d8ec2a3f
commit d8de0fe341

View file

@ -856,8 +856,10 @@ void dismissGCRAObject(robj *o, size_t size_hint) {
* it can reduce unnecessary iteration for complex data types that are probably
* not going to release any memory. */
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;
/* madvise(MADV_DONTNEED) may not work if Transparent Huge Pages is enabled.
* Strings use sdsfree() which doesn't depend on madvise, so skip this
* check for them. */
if (server.thp_enabled && o->type != OBJ_STRING) return;
/* 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. */