patch 'eal/linux: fix dirty flag for reused hugepages in legacy mem' has been queued to stable release 25.11.5
Kevin Traynor
ktraynor at redhat.com
Thu Dec 3 14:05:04 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/08/26. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/8b7529bd2eb8d4590be2144f6d7d26cf70e4d253
Thanks.
Kevin
---
>From 8b7529bd2eb8d4590be2144f6d7d26cf70e4d253 Mon Sep 17 00:00:00 2001
From: Maayan Kashani <mkashani at nvidia.com>
Date: Thu, 5 Nov 2026 09:17:10 +0200
Subject: [PATCH] eal/linux: fix dirty flag for reused hugepages in legacy mem
[ upstream commit f487d4337d78347db2b33bfaf87a5032e6c065a3 ]
With --huge-unlink=never the hugepage files are kept and mapped again
on the next run. The kernel only zeroes a hugepage the first time it is
mapped from a given file, so these pages still hold the previous run's
content.
The dynamic memory path records this by setting RTE_MEMSEG_FLAG_DIRTY
in alloc_seg(). The legacy path in remap_segment() never sets ms->flags,
so rte_zmalloc_socket() skips the memset and returns stale data.
With --legacy-mem --huge-unlink=never, a second process gets non-zeroed
memory from rte_zmalloc(). mlx5 with sys_mem_en disabled allocates its
internal structures through rte_zmalloc_socket() and then reads stale
pointers from them, which crashes in mlx5_ipool_malloc_cache() during
probe:
SEGV on unknown address 0x000000000308
#0 _mlx5_ipool_malloc_cache drivers/net/mlx5/mlx5_utils.c:550
...
#16 mlx5_alloc_shared_dr drivers/net/mlx5/linux/mlx5_os.c:628
Set RTE_MEMSEG_FLAG_DIRTY on segments remapped in legacy mode whenever
existing hugepage files are reused, matching the dynamic path. Why a
reused page is dirty is documented on unlink_existing.
Fixes: 32b4771cd8ef ("eal/linux: allow hugepage file reuse")
Signed-off-by: Maayan Kashani <mkashani at nvidia.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk at gmail.com>
---
lib/eal/common/eal_internal_cfg.h | 8 +++++++-
lib/eal/linux/eal_memory.c | 5 +++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h
index 95d327a613..d3bf0290d0 100644
--- a/lib/eal/common/eal_internal_cfg.h
+++ b/lib/eal/common/eal_internal_cfg.h
@@ -45,5 +45,11 @@ struct hugepage_file_discipline {
/** Unlink files before mapping them to leave no trace in hugetlbfs. */
bool unlink_before_mapping;
- /** Unlink existing files at startup, re-create them before mapping. */
+ /**
+ * Unlink existing files at startup and re-create them before mapping.
+ * If false, the files are kept and mapped again. The kernel zeroes a
+ * hugepage only the first time it is mapped from a given file, so
+ * reused pages still hold the previous content and must be treated
+ * as dirty.
+ */
bool unlink_existing;
};
diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
index 8e1763e890..5f62c7e364 100644
--- a/lib/eal/linux/eal_memory.c
+++ b/lib/eal/linux/eal_memory.c
@@ -681,8 +681,8 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
size_t memseg_len;
int socket_id;
-#ifndef RTE_ARCH_64
const struct internal_config *internal_conf =
eal_get_internal_configuration();
-#endif
+ const bool dirty = !internal_conf->hugepage_file.unlink_existing;
+
page_sz = hugepages[seg_start].size;
socket_id = hugepages[seg_start].socket_id;
@@ -798,4 +798,5 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
ms->nchannel = rte_memory_get_nchannel();
ms->nrank = rte_memory_get_nrank();
+ ms->flags = dirty ? RTE_MEMSEG_FLAG_DIRTY : 0;
rte_fbarray_set_used(arr, ms_idx);
--
2.56.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-12-03 12:52:49.877796921 +0000
+++ 0378-eal-linux-fix-dirty-flag-for-reused-hugepages-in-leg.patch 2026-12-03 12:52:39.287952771 +0000
@@ -1 +1 @@
-From f487d4337d78347db2b33bfaf87a5032e6c065a3 Mon Sep 17 00:00:00 2001
+From 8b7529bd2eb8d4590be2144f6d7d26cf70e4d253 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit f487d4337d78347db2b33bfaf87a5032e6c065a3 ]
+
@@ -31 +32,0 @@
-Cc: stable at dpdk.org
@@ -41 +42 @@
-index 07cd35167d..1221e03253 100644
+index 95d327a613..d3bf0290d0 100644
@@ -58 +59 @@
-index 614f31a308..0edf66eea5 100644
+index 8e1763e890..5f62c7e364 100644
@@ -61 +62 @@
-@@ -693,8 +693,8 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
+@@ -681,8 +681,8 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
@@ -72 +73 @@
-@@ -817,4 +817,5 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
+@@ -798,4 +798,5 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
More information about the stable
mailing list