memcached: drop libhugetlbfs

In Linux, memcached relies on transparent huge pages, and even if
libhugetlbfs is enabled by the PACKAGECONFIG (and detected during
do_configure, of course), it is simply not used:

root@qemuriscv64:~# ldd $(which memcached)
    linux-vdso.so.1 (0x0000003fa4358000)
    libevent-2.1.so.7 => /lib/libevent-2.1.so.7 (0x0000003fa42b0000)
    libc.so.6 => /lib/libc.so.6 (0x0000003fa4157000)
    /usr/lib/ld-linux-riscv64-lp64d.so.1 (0x0000003fa435a000)

The main reason is the fact that the only call to a function coming from
libhugetlbfs is here:

https://github.com/memcached/memcached/blob/master/memcached.c#L4274

and getpagesizes() is only called if the #if block evaluates to true:

    int ret = -1;
    size_t sizes[32];
    int avail = getpagesizes(sizes, 32);
(...)
    /* check if transparent hugepages is compiled into the kernel */
    /* RH based systems possibly uses a different path */
    static const char *mm_thp_paths[] = {
        "/sys/kernel/mm/transparent_hugepage/enabled",
        "/sys/kernel/mm/redhat_transparent_hugepage/enabled",
        NULL
    };
(...)

This block relies on HAVE_MEMCNTL, which is a Solaris-specific feature.
Therefore, the dependency link between memcached and libhugetlbfs
doesn't exist in Linux.

Drop libhugetlbfs from memcached's recipe.

Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Joao Marcos Costa
2026-04-24 17:02:06 +02:00
committed by Khem Raj
parent 0af2c62a38
commit 05191ba25b
2 changed files with 2 additions and 40 deletions
@@ -1,32 +0,0 @@
From dfa90817a08f206f7e2dbba44d913968ae7f7d94 Mon Sep 17 00:00:00 2001
From: Chong Lu <Chong.Lu@windriver.com>
Date: Tue, 19 Aug 2014 17:38:32 +0800
Subject: [PATCH] memcached: add knob to detect whether hugetlbfs are checked
Add knob to detect whether hugetlbfs are checked or not.
Upstream-Status: Pending
Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
---
configure.ac | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 6f2ef97..bd7dd96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -559,8 +559,12 @@ if test "x$enable_static" = "xyes"; then
fi
dnl ----------------------------------------------------------------------------
+AC_ARG_ENABLE(hugetlbfs,
+ [AS_HELP_STRING([--enable-hugetlbfs],[Enable hugetlbfs])])
-AC_SEARCH_LIBS(gethugepagesizes, hugetlbfs)
+if test "x$enable_hugetlbfs" = "xyes"; then
+ AC_SEARCH_LIBS(gethugepagesizes, hugetlbfs)
+fi
AC_HEADER_STDBOOL
AH_BOTTOM([#if HAVE_STDBOOL_H
@@ -19,17 +19,14 @@ RDEPENDS:${PN} += "perl perl-module-posix perl-module-autoloader \
perl-module-tie-hash bash \ perl-module-tie-hash bash \
" "
SRC_URI = "http://www.memcached.org/files/${BP}.tar.gz \ SRC_URI = "http://www.memcached.org/files/${BP}.tar.gz"
file://memcached-add-hugetlbfs-check.patch \
"
SRC_URI[sha256sum] = "e097073c156eeff9e12655b054f446d57374cfba5c132dcdbe7fac64e728286a" SRC_URI[sha256sum] = "e097073c156eeff9e12655b054f446d57374cfba5c132dcdbe7fac64e728286a"
CVE_STATUS[CVE-2022-26635] = "disputed: this is a problem of applications using php-memcached inproperly" CVE_STATUS[CVE-2022-26635] = "disputed: this is a problem of applications using php-memcached inproperly"
UPSTREAM_CHECK_URI = "${HOMEPAGE}" UPSTREAM_CHECK_URI = "${HOMEPAGE}"
# set the same COMPATIBLE_HOST as libhugetlbfs COMPATIBLE_HOST = "(i.86|x86_64|powerpc|powerpc64|riscv64|aarch64|arm).*-linux*"
COMPATIBLE_HOST = "(i.86|x86_64|powerpc|powerpc64|aarch64|arm).*-linux*"
# assoc.c:83:9: error: variable 'depth' set but not used [-Werror,-Wunused-but-set-variable] # assoc.c:83:9: error: variable 'depth' set but not used [-Werror,-Wunused-but-set-variable]
CFLAGS:append:toolchain-clang = " -Wno-error=unused-but-set-variable" CFLAGS:append:toolchain-clang = " -Wno-error=unused-but-set-variable"
@@ -42,9 +39,6 @@ python __anonymous () {
d.appendVar('EXTRA_OECONF', " ac_cv_c_endian=big") d.appendVar('EXTRA_OECONF', " ac_cv_c_endian=big")
} }
PACKAGECONFIG ??= ""
PACKAGECONFIG[hugetlbfs] = "--enable-hugetlbfs, --disable-hugetlbfs, libhugetlbfs"
inherit update-rc.d inherit update-rc.d
INITSCRIPT_NAME = "memcached" INITSCRIPT_NAME = "memcached"