diff mbox series

[meta-networking] memcached: drop libhugetlbfs

Message ID 20260424150206.10679-1-joaomarcos.costa@bootlin.com
State Under Review
Headers show
Series [meta-networking] memcached: drop libhugetlbfs | expand

Commit Message

João Marcos Costa April 24, 2026, 3:02 p.m. UTC
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>
---
 .../memcached-add-hugetlbfs-check.patch       | 32 -------------------
 .../memcached/memcached_1.6.41.bb             | 10 ++----
 2 files changed, 2 insertions(+), 40 deletions(-)
 delete mode 100644 meta-networking/recipes-support/memcached/memcached/memcached-add-hugetlbfs-check.patch
diff mbox series

Patch

diff --git a/meta-networking/recipes-support/memcached/memcached/memcached-add-hugetlbfs-check.patch b/meta-networking/recipes-support/memcached/memcached/memcached-add-hugetlbfs-check.patch
deleted file mode 100644
index 26281e73ef..0000000000
--- a/meta-networking/recipes-support/memcached/memcached/memcached-add-hugetlbfs-check.patch
+++ /dev/null
@@ -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
diff --git a/meta-networking/recipes-support/memcached/memcached_1.6.41.bb b/meta-networking/recipes-support/memcached/memcached_1.6.41.bb
index 9d759069ba..e41ebdb171 100644
--- a/meta-networking/recipes-support/memcached/memcached_1.6.41.bb
+++ b/meta-networking/recipes-support/memcached/memcached_1.6.41.bb
@@ -19,17 +19,14 @@  RDEPENDS:${PN} += "perl perl-module-posix perl-module-autoloader \
     perl-module-tie-hash bash \
     "
 
-SRC_URI = "http://www.memcached.org/files/${BP}.tar.gz \
-           file://memcached-add-hugetlbfs-check.patch \
-           "
+SRC_URI = "http://www.memcached.org/files/${BP}.tar.gz"
 SRC_URI[sha256sum] = "e097073c156eeff9e12655b054f446d57374cfba5c132dcdbe7fac64e728286a"
 
 CVE_STATUS[CVE-2022-26635] = "disputed: this is a problem of applications using php-memcached inproperly"
 
 UPSTREAM_CHECK_URI = "${HOMEPAGE}"
 
-# set the same COMPATIBLE_HOST as libhugetlbfs
-COMPATIBLE_HOST = "(i.86|x86_64|powerpc|powerpc64|aarch64|arm).*-linux*"
+COMPATIBLE_HOST = "(i.86|x86_64|powerpc|powerpc64|riscv64|aarch64|arm).*-linux*"
 
 # 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"
@@ -42,9 +39,6 @@  python __anonymous () {
         d.appendVar('EXTRA_OECONF', " ac_cv_c_endian=big")
 }
 
-PACKAGECONFIG ??= ""
-PACKAGECONFIG[hugetlbfs] = "--enable-hugetlbfs, --disable-hugetlbfs, libhugetlbfs"
-
 inherit update-rc.d
 
 INITSCRIPT_NAME = "memcached"