[PATCH] eal/linux: ignore ENOENT when unlinking hugepages

Sunyang Wu sunyang.wu at jaguarmicro.com
Sun Nov 29 09:53:26 CET 2026


In --huge-unlink mode, alloc_seg() may attempt to unlink a hugepage
file that has already been unlinked in a previous step (especially
during dynamic memory allocation / memseg resize).

This leads to:
EAL: alloc_seg(): unlink() failed: No such file or directory
EAL: attempted to allocate 1 segments, but only 0 were allocated

Fix this by ignoring ENOENT (No such file or directory) on unlink(),
as it means the file has already been successfully removed, which
is the desired outcome for --huge-unlink.

The change only affects the unlink_before_mapping path and does not
mask other real errors.

Fixes: 44dfa8a171 ("eal/linux: remove support for Linux < 3.17")
Cc: stable at dpdk.org

Signed-off-by: Sunyang Wu <sunyang.wu at jaguarmicro.com>
---
 lib/eal/linux/eal_memalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
index 8bfcbb1469..3157b9c9f1 100644
--- a/lib/eal/linux/eal_memalloc.c
+++ b/lib/eal/linux/eal_memalloc.c
@@ -551,7 +551,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 		}
 		if (internal_conf->hugepage_file.unlink_before_mapping &&
 				!internal_conf->in_memory) {
-			if (unlink(path)) {
+			if (unlink(path) && errno != ENOENT) {
 				EAL_LOG(DEBUG, "%s(): unlink() failed: %s",
 					__func__, strerror(errno));
 				goto resized;
-- 
2.55.0.windows.3




More information about the stable mailing list