DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sunyang Wu <sunyang.wu@jaguarmicro.com>
To: dev@dpdk.org
Cc: anatoly.burakov@intel.com, david.marchand@redhat.com,
	stephen@networkplumber.org, scott.k.mitch1@gmail.com,
	stable@dpdk.org
Subject: [PATCH] eal/linux: ignore ENOENT when unlinking hugepages
Date: Sun, 29 Nov 2026 16:53:26 +0800	[thread overview]
Message-ID: <20261129165326.41928.5520@jaguarmicro.com> (raw)

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@dpdk.org

Signed-off-by: Sunyang Wu <sunyang.wu@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



             reply	other threads:[~2026-11-29  8:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  8:53 Sunyang Wu [this message]
2026-11-29  9:12 ` [PATCH v2] eal/linux: ignore ENOENT when unlinking hugepages Sunyang Wu
2026-11-30  9:11   ` Bruce Richardson
2026-11-30 11:11   ` [PATCH v3] " Sunyang Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261129165326.41928.5520@jaguarmicro.com \
    --to=sunyang.wu@jaguarmicro.com \
    --cc=anatoly.burakov@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=scott.k.mitch1@gmail.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox