From: Jake Freeland <jfree@FreeBSD.org>
To: Anatoly Burakov <anatoly.burakov@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>
Cc: Jake Freeland <jfree@FreeBSD.org>, dev@dpdk.org
Subject: [PATCH v3 1/3] eal/freebsd: do not use prev_ms_idx for hole detection
Date: Wed, 14 Jan 2026 18:31:27 +0900 [thread overview]
Message-ID: <20260114093140.3256584-2-jfree@FreeBSD.org> (raw)
In-Reply-To: <20260114093140.3256584-1-jfree@FreeBSD.org>
Use rte_fbarray_is_used() to check if the previous fbarray entry is
already empty.
Using prev_ms_idx to do this is flawed in cases where we loop through
multiple memseg lists. Each memseg list has its own count and length,
so using a prev_ms_idx from one memseg list to check for used entries
in another non-empty memseg list can lead to incorrect hole placement.
Signed-off-by: Jake Freeland <jfree@FreeBSD.org>
---
lib/eal/freebsd/eal_memory.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/eal/freebsd/eal_memory.c b/lib/eal/freebsd/eal_memory.c
index 6d3d46a390..8c315d97d5 100644
--- a/lib/eal/freebsd/eal_memory.c
+++ b/lib/eal/freebsd/eal_memory.c
@@ -103,7 +103,6 @@ rte_eal_hugepage_init(void)
for (i = 0; i < internal_conf->num_hugepage_sizes; i++) {
struct hugepage_info *hpi;
rte_iova_t prev_end = 0;
- int prev_ms_idx = -1;
uint64_t page_sz, mem_needed;
unsigned int n_pages, max_pages;
@@ -167,9 +166,13 @@ rte_eal_hugepage_init(void)
if (ms_idx < 0)
continue;
- if (need_hole && prev_ms_idx == ms_idx - 1)
+ /* ms_idx should never be 0 if we need a hole,
+ * but include a check for static analysis.
+ */
+ if (need_hole &&
+ ms_idx > 0 &&
+ rte_fbarray_is_used(arr, ms_idx - 1))
ms_idx++;
- prev_ms_idx = ms_idx;
break;
}
--
2.51.0
next prev parent reply other threads:[~2026-01-14 9:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 21:32 [PATCH v2 0/3] EAL memory fixes Jake Freeland
2025-08-14 21:32 ` [PATCH v2 1/3] eal/freebsd: Do not use prev_ms_idx for hole detection Jake Freeland
2025-10-13 12:23 ` Burakov, Anatoly
2025-10-14 9:06 ` Burakov, Anatoly
2025-08-14 21:32 ` [PATCH v2 2/3] eal/freebsd: Avoid claiming memseg holes Jake Freeland
2025-10-13 12:36 ` Burakov, Anatoly
2025-10-13 13:12 ` Burakov, Anatoly
2025-08-14 21:32 ` [PATCH v2 3/3] eal/linux: Check hugepage access permissions Jake Freeland
2025-10-13 12:43 ` Burakov, Anatoly
2025-10-15 16:53 ` [PATCH v2 0/3] EAL memory fixes Thomas Monjalon
2026-01-14 6:37 ` Stephen Hemminger
2026-01-14 9:31 ` [PATCH v3 " Jake Freeland
2026-01-14 9:31 ` Jake Freeland [this message]
2026-01-14 9:31 ` [PATCH v3 2/3] eal/freebsd: avoid claiming memseg holes Jake Freeland
2026-01-14 9:31 ` [PATCH v3 3/3] eal/linux: check hugepage access permissions Jake Freeland
2026-01-14 10:04 ` [PATCH v4] " Jake Freeland
2026-02-13 16:01 ` [PATCH v3 3/3] " David Marchand
2026-02-13 16:02 ` [PATCH v3 0/3] EAL memory fixes David Marchand
2026-01-23 5:09 ` [PATCH v2 " Stephen Hemminger
2026-01-23 17:43 ` Jake Freeland
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=20260114093140.3256584-2-jfree@FreeBSD.org \
--to=jfree@freebsd.org \
--cc=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.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