From d8de0fe3417f7685065a6c8a25543155753e8cea Mon Sep 17 00:00:00 2001 From: Yangbo Long Date: Mon, 25 May 2026 11:52:22 -0400 Subject: [PATCH] Bypass the THP check for strings --- src/object.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/object.c b/src/object.c index f9122b741..3d747ea3a 100644 --- a/src/object.c +++ b/src/object.c @@ -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. */