patch 'eal/linux: fix dirty flag for reused hugepages in legacy mem' has been queued to stable release 24.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Nov 16 23:51:31 CET 2026


Hi,

FYI, your patch has been queued to stable release 24.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/18/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/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/567f5fa0867fea3943e9ee7007aabd11ebf98c30

Thanks.

Luca Boccassi

---
>From 567f5fa0867fea3943e9ee7007aabd11ebf98c30 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 f53ab8b4aa..6f049bc7b4 100644
--- a/lib/eal/common/eal_internal_cfg.h
+++ b/lib/eal/common/eal_internal_cfg.h
@@ -44,7 +44,13 @@ struct simd_bitwidth {
 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 5ef1575b66..a5d1c51329 100644
--- a/lib/eal/linux/eal_memory.c
+++ b/lib/eal/linux/eal_memory.c
@@ -680,10 +680,10 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
 	uint64_t page_sz;
 	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;
 	seg_len = seg_end - seg_start;
@@ -797,6 +797,7 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
 		ms->socket_id = hfile->socket_id;
 		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.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-11-16 22:52:17.200472485 +0000
+++ 0017-eal-linux-fix-dirty-flag-for-reused-hugepages-in-leg.patch	2026-11-16 22:52:16.432232001 +0000
@@ -1 +1 @@
-From f487d4337d78347db2b33bfaf87a5032e6c065a3 Mon Sep 17 00:00:00 2001
+From 567f5fa0867fea3943e9ee7007aabd11ebf98c30 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 f53ab8b4aa..6f049bc7b4 100644
@@ -60 +61 @@
-index 614f31a308..0edf66eea5 100644
+index 5ef1575b66..a5d1c51329 100644
@@ -63 +64 @@
-@@ -692,10 +692,10 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
+@@ -680,10 +680,10 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
@@ -76 +77 @@
-@@ -816,6 +816,7 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
+@@ -797,6 +797,7 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)


More information about the stable mailing list