* [PATCH] eal/linux: ignore ENOENT when unlinking hugepages
@ 2026-11-29 8:53 Sunyang Wu
2026-11-29 9:12 ` [PATCH v2] " Sunyang Wu
0 siblings, 1 reply; 4+ messages in thread
From: Sunyang Wu @ 2026-11-29 8:53 UTC (permalink / raw)
To: dev; +Cc: anatoly.burakov, david.marchand, stephen, scott.k.mitch1, stable
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
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v2] eal/linux: ignore ENOENT when unlinking hugepages
2026-11-29 8:53 [PATCH] eal/linux: ignore ENOENT when unlinking hugepages Sunyang Wu
@ 2026-11-29 9:12 ` Sunyang Wu
2026-11-30 9:11 ` Bruce Richardson
2026-11-30 11:11 ` [PATCH v3] " Sunyang Wu
0 siblings, 2 replies; 4+ messages in thread
From: Sunyang Wu @ 2026-11-29 9:12 UTC (permalink / raw)
To: dev; +Cc: anatoly.burakov, david.marchand, stephen, scott.k.mitch1, stable
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: 44dfa8a17109 ("eal/linux: remove support for Linux < 3.17")
Cc: stable@dpdk.org
Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
---
v2:
* Use 12 characters of sha1 in the Fixes tag, as checkpatch expects.
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
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] eal/linux: ignore ENOENT when unlinking hugepages
2026-11-29 9:12 ` [PATCH v2] " Sunyang Wu
@ 2026-11-30 9:11 ` Bruce Richardson
2026-11-30 11:11 ` [PATCH v3] " Sunyang Wu
1 sibling, 0 replies; 4+ messages in thread
From: Bruce Richardson @ 2026-11-30 9:11 UTC (permalink / raw)
To: Sunyang Wu
Cc: dev, anatoly.burakov, david.marchand, stephen, scott.k.mitch1,
stable
On Sun, Nov 29, 2026 at 05:12:47PM +0800, Sunyang Wu wrote:
> 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: 44dfa8a17109 ("eal/linux: remove support for Linux < 3.17")
> Cc: stable@dpdk.org
>
> Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
> ---
> v2:
> * Use 12 characters of sha1 in the Fixes tag, as checkpatch expects.
>
> 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;
> --
Seems reasonable.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
One minor nit not introduced by this patch (and that perhaps can be fixed
on apply) is that for alignment with DPDK styling and clarity, the
"unlink(path)" should be explicitly "unlink(path) != 0"
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v3] eal/linux: ignore ENOENT when unlinking hugepages
2026-11-29 9:12 ` [PATCH v2] " Sunyang Wu
2026-11-30 9:11 ` Bruce Richardson
@ 2026-11-30 11:11 ` Sunyang Wu
1 sibling, 0 replies; 4+ messages in thread
From: Sunyang Wu @ 2026-11-30 11:11 UTC (permalink / raw)
To: dev; +Cc: anatoly.burakov, david.marchand, bruce.richardson, thomas, stable
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: 44dfa8a17109 ("eal/linux: remove support for Linux < 3.17")
Cc: stable@dpdk.org
Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v3:
* Compare unlink() against 0 explicitly, as suggested by Bruce Richardson.
No functional change.
v2:
* Use 12 characters of sha1 in the Fixes tag, as checkpatch expects.
---
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..8de62db0c4 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) != 0 && errno != ENOENT) {
EAL_LOG(DEBUG, "%s(): unlink() failed: %s",
__func__, strerror(errno));
goto resized;
--
2.55.0.windows.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-30 11:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 8:53 [PATCH] eal/linux: ignore ENOENT when unlinking hugepages Sunyang Wu
2026-11-29 9:12 ` [PATCH v2] " Sunyang Wu
2026-11-30 9:11 ` Bruce Richardson
2026-11-30 11:11 ` [PATCH v3] " Sunyang Wu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox