* [PATCH] mempool: remove cache flush threshold
@ 2026-07-24 12:07 Morten Brørup
2026-07-24 13:35 ` Andrew Rybchenko
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Morten Brørup @ 2026-07-24 12:07 UTC (permalink / raw)
To: dev, Andrew Rybchenko, Jie Liu; +Cc: Morten Brørup
mempool: remove cache flush threshold
Removed the mempool cache flush threshold field (``flushthresh``),
which was obsolete and marked for removal.
Reduced the size of the mempool cache objects array; it was double the
required size.
Also fixed a couple of commments.
The sxe2 driver was updated to use the ``size`` field instead of the
``flushthresh`` field; it contains the same value.
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
doc/guides/rel_notes/release_26_11.rst | 5 +++++
drivers/net/sxe2/sxe2_txrx_vec_avx512.c | 2 +-
lib/mempool/mempool_trace.h | 1 -
lib/mempool/rte_mempool.c | 5 ++---
lib/mempool/rte_mempool.h | 15 ++++-----------
5 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
index 938617ca75..8a109cae56 100644
--- a/doc/guides/rel_notes/release_26_11.rst
+++ b/doc/guides/rel_notes/release_26_11.rst
@@ -100,6 +100,11 @@ ABI Changes
Also, make sure to start the actual text at the margin.
=======================================================
+* mempool: The structure ``rte_mempool_cache`` was updated as follows:
+ - The obsolete ``flushthresh`` field was removed.
+ - The size of the ``objs`` array was reduced from ``RTE_MEMPOOL_CACHE_MAX_SIZE`` * 2 to ``RTE_MEMPOOL_CACHE_MAX_SIZE``.
+ - A cache guard was added at the end of the structure.
+
Known Issues
------------
diff --git a/drivers/net/sxe2/sxe2_txrx_vec_avx512.c b/drivers/net/sxe2/sxe2_txrx_vec_avx512.c
index a830c7a33b..2e680f4027 100644
--- a/drivers/net/sxe2/sxe2_txrx_vec_avx512.c
+++ b/drivers/net/sxe2/sxe2_txrx_vec_avx512.c
@@ -67,7 +67,7 @@ static __rte_always_inline int32_t sxe2_tx_bufs_free_vec_avx512(struct sxe2_tx_q
}
cache->len += rs_thresh;
- if (cache->len >= cache->flushthresh) {
+ if (cache->len >= cache->size) {
(void)rte_mempool_ops_enqueue_bulk(mp,
&cache->objs[cache->size], cache->len - cache->size);
cache->len = cache->size;
diff --git a/lib/mempool/mempool_trace.h b/lib/mempool/mempool_trace.h
index 23cda1473c..60e47cf67b 100644
--- a/lib/mempool/mempool_trace.h
+++ b/lib/mempool/mempool_trace.h
@@ -119,7 +119,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_i32(socket_id);
rte_trace_point_emit_ptr(cache);
rte_trace_point_emit_u32(cache->len);
- rte_trace_point_emit_u32(cache->flushthresh);
)
RTE_TRACE_POINT(
diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index 817e2b8dc1..4a79a4c800 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -753,7 +753,6 @@ static void
mempool_cache_init(struct rte_mempool_cache *cache, uint32_t size)
{
cache->size = size;
- cache->flushthresh = size; /* Obsolete; for API/ABI compatibility purposes only */
cache->len = 0;
}
@@ -1197,6 +1196,7 @@ mempool_obj_audit(struct rte_mempool *mp, __rte_unused void *opaque,
RTE_MEMPOOL_CHECK_COOKIES(mp, &obj, 1, 2);
}
+/* check cookies before and after objects */
static void
mempool_audit_cookies(struct rte_mempool *mp)
{
@@ -1213,11 +1213,10 @@ mempool_audit_cookies(struct rte_mempool *mp)
#define mempool_audit_cookies(mp) do {} while(0)
#endif
-/* check cookies before and after objects */
+/* check cache size consistency */
static void
mempool_audit_cache(const struct rte_mempool *mp)
{
- /* check cache size consistency */
unsigned lcore_id;
if (mp->cache_size == 0)
diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
index 50d958c7c6..b531c8cbb5 100644
--- a/lib/mempool/rte_mempool.h
+++ b/lib/mempool/rte_mempool.h
@@ -89,14 +89,13 @@ struct __rte_cache_aligned rte_mempool_debug_stats {
*/
struct __rte_cache_aligned rte_mempool_cache {
uint32_t size; /**< Size of the cache */
- uint32_t flushthresh; /**< Obsolete; for API/ABI compatibility purposes only */
uint32_t len; /**< Current cache count */
#ifdef RTE_LIBRTE_MEMPOOL_STATS
- uint32_t unused;
/*
* Alternative location for the most frequently updated mempool statistics (per-lcore),
* providing faster update access when using a mempool cache.
*/
+ alignas(16)
struct {
uint64_t put_bulk; /**< Number of puts. */
uint64_t put_objs; /**< Number of objects successfully put. */
@@ -104,15 +103,9 @@ struct __rte_cache_aligned rte_mempool_cache {
uint64_t get_success_objs; /**< Objects successfully allocated. */
} stats; /**< Statistics */
#endif
- /**
- * Cache objects
- *
- * Note:
- * Cache is allocated at double size for API/ABI compatibility purposes only.
- * When reducing its size at an API/ABI breaking release,
- * remember to add a cache guard after it.
- */
- alignas(RTE_CACHE_LINE_SIZE) void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2];
+ /** Cache objects */
+ alignas(RTE_CACHE_LINE_SIZE) void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE];
+ RTE_CACHE_GUARD;
};
/**
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mempool: remove cache flush threshold
2026-07-24 12:07 [PATCH] mempool: remove cache flush threshold Morten Brørup
@ 2026-07-24 13:35 ` Andrew Rybchenko
2026-07-24 15:14 ` [PATCH v2] mempool: remove cache flush threshold field Morten Brørup
2026-08-06 15:45 ` [PATCH v3] " Morten Brørup
2 siblings, 0 replies; 6+ messages in thread
From: Andrew Rybchenko @ 2026-07-24 13:35 UTC (permalink / raw)
To: Morten Brørup, dev, Jie Liu
On 7/24/26 3:07 PM, Morten Brørup wrote:
> mempool: remove cache flush threshold
>
> Removed the mempool cache flush threshold field (``flushthresh``),
> which was obsolete and marked for removal.
>
> Reduced the size of the mempool cache objects array; it was double the
> required size.
>
> Also fixed a couple of commments.
>
> The sxe2 driver was updated to use the ``size`` field instead of the
> ``flushthresh`` field; it contains the same value.
>
> Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] mempool: remove cache flush threshold field
2026-07-24 12:07 [PATCH] mempool: remove cache flush threshold Morten Brørup
2026-07-24 13:35 ` Andrew Rybchenko
@ 2026-07-24 15:14 ` Morten Brørup
2026-08-06 15:45 ` [PATCH v3] " Morten Brørup
2 siblings, 0 replies; 6+ messages in thread
From: Morten Brørup @ 2026-07-24 15:14 UTC (permalink / raw)
To: dev, Andrew Rybchenko, Jie Liu; +Cc: Morten Brørup
Removed the mempool cache flush threshold field (``flushthresh``),
which was obsolete and marked for removal.
Reduced the size of the mempool cache objects array; it was double the
required size.
Also fixed a couple of commments.
The sxe2 driver was updated to use the ``size`` field instead of the
``flushthresh`` field; it contains the same value.
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
v2:
* Fixed typo in commit message.
* Release notes: No need to mention added cache guard. (AI)
* Release notes: Added note about flushthresh removal
under removed items. (AI)
* Added note about 16-byte alignment of stats. (AI)
---
doc/guides/rel_notes/release_26_11.rst | 6 ++++++
drivers/net/sxe2/sxe2_txrx_vec_avx512.c | 2 +-
lib/mempool/mempool_trace.h | 1 -
lib/mempool/rte_mempool.c | 8 ++------
lib/mempool/rte_mempool.h | 16 +++++-----------
5 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
index 938617ca75..1083bc56b4 100644
--- a/doc/guides/rel_notes/release_26_11.rst
+++ b/doc/guides/rel_notes/release_26_11.rst
@@ -68,6 +68,8 @@ Removed Items
Also, make sure to start the actual text at the margin.
=======================================================
+* mempool: The obsolete ``flushthresh`` field was removed from the ``rte_mempool_cache`` structure.
+
API Changes
-----------
@@ -100,6 +102,10 @@ ABI Changes
Also, make sure to start the actual text at the margin.
=======================================================
+* mempool: The ``rte_mempool_cache`` structure was updated as follows:
+ - The obsolete ``flushthresh`` field was removed.
+ - The size of the ``objs`` array was reduced from ``RTE_MEMPOOL_CACHE_MAX_SIZE`` * 2 to ``RTE_MEMPOOL_CACHE_MAX_SIZE``.
+
Known Issues
------------
diff --git a/drivers/net/sxe2/sxe2_txrx_vec_avx512.c b/drivers/net/sxe2/sxe2_txrx_vec_avx512.c
index a830c7a33b..2e680f4027 100644
--- a/drivers/net/sxe2/sxe2_txrx_vec_avx512.c
+++ b/drivers/net/sxe2/sxe2_txrx_vec_avx512.c
@@ -67,7 +67,7 @@ static __rte_always_inline int32_t sxe2_tx_bufs_free_vec_avx512(struct sxe2_tx_q
}
cache->len += rs_thresh;
- if (cache->len >= cache->flushthresh) {
+ if (cache->len >= cache->size) {
(void)rte_mempool_ops_enqueue_bulk(mp,
&cache->objs[cache->size], cache->len - cache->size);
cache->len = cache->size;
diff --git a/lib/mempool/mempool_trace.h b/lib/mempool/mempool_trace.h
index 23cda1473c..60e47cf67b 100644
--- a/lib/mempool/mempool_trace.h
+++ b/lib/mempool/mempool_trace.h
@@ -119,7 +119,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_i32(socket_id);
rte_trace_point_emit_ptr(cache);
rte_trace_point_emit_u32(cache->len);
- rte_trace_point_emit_u32(cache->flushthresh);
)
RTE_TRACE_POINT(
diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index 817e2b8dc1..09660e89ac 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -753,7 +753,6 @@ static void
mempool_cache_init(struct rte_mempool_cache *cache, uint32_t size)
{
cache->size = size;
- cache->flushthresh = size; /* Obsolete; for API/ABI compatibility purposes only */
cache->len = 0;
}
@@ -1197,6 +1196,7 @@ mempool_obj_audit(struct rte_mempool *mp, __rte_unused void *opaque,
RTE_MEMPOOL_CHECK_COOKIES(mp, &obj, 1, 2);
}
+/* check cookies before and after objects */
static void
mempool_audit_cookies(struct rte_mempool *mp)
{
@@ -1213,11 +1213,10 @@ mempool_audit_cookies(struct rte_mempool *mp)
#define mempool_audit_cookies(mp) do {} while(0)
#endif
-/* check cookies before and after objects */
+/* check cache size consistency */
static void
mempool_audit_cache(const struct rte_mempool *mp)
{
- /* check cache size consistency */
unsigned lcore_id;
if (mp->cache_size == 0)
@@ -1241,9 +1240,6 @@ rte_mempool_audit(struct rte_mempool *mp)
{
mempool_audit_cache(mp);
mempool_audit_cookies(mp);
-
- /* For case where mempool DEBUG is not set, and cache size is 0 */
- RTE_SET_USED(mp);
}
/* dump the status of the mempool on the console */
diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
index 50d958c7c6..2fa70812d5 100644
--- a/lib/mempool/rte_mempool.h
+++ b/lib/mempool/rte_mempool.h
@@ -89,14 +89,14 @@ struct __rte_cache_aligned rte_mempool_debug_stats {
*/
struct __rte_cache_aligned rte_mempool_cache {
uint32_t size; /**< Size of the cache */
- uint32_t flushthresh; /**< Obsolete; for API/ABI compatibility purposes only */
uint32_t len; /**< Current cache count */
#ifdef RTE_LIBRTE_MEMPOOL_STATS
- uint32_t unused;
/*
* Alternative location for the most frequently updated mempool statistics (per-lcore),
* providing faster update access when using a mempool cache.
+ * Note: 16-byte aligned for optimal SIMD access, when updating pairs of counters.
*/
+ alignas(16)
struct {
uint64_t put_bulk; /**< Number of puts. */
uint64_t put_objs; /**< Number of objects successfully put. */
@@ -104,15 +104,9 @@ struct __rte_cache_aligned rte_mempool_cache {
uint64_t get_success_objs; /**< Objects successfully allocated. */
} stats; /**< Statistics */
#endif
- /**
- * Cache objects
- *
- * Note:
- * Cache is allocated at double size for API/ABI compatibility purposes only.
- * When reducing its size at an API/ABI breaking release,
- * remember to add a cache guard after it.
- */
- alignas(RTE_CACHE_LINE_SIZE) void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2];
+ /** Cache objects */
+ alignas(RTE_CACHE_LINE_SIZE) void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE];
+ RTE_CACHE_GUARD;
};
/**
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3] mempool: remove cache flush threshold field
2026-07-24 12:07 [PATCH] mempool: remove cache flush threshold Morten Brørup
2026-07-24 13:35 ` Andrew Rybchenko
2026-07-24 15:14 ` [PATCH v2] mempool: remove cache flush threshold field Morten Brørup
@ 2026-08-06 15:45 ` Morten Brørup
2026-08-07 7:00 ` Morten Brørup
2 siblings, 1 reply; 6+ messages in thread
From: Morten Brørup @ 2026-08-06 15:45 UTC (permalink / raw)
To: dev, Andrew Rybchenko, Jie Liu; +Cc: Morten Brørup
Removed the mempool cache flush threshold field (``flushthresh``),
which was obsolete and marked for removal.
Reduced the size of the mempool cache objects array; it was double the
required size.
Also fixed a couple of commments.
The sxe2 driver was updated to use the ``size`` field instead of the
``flushthresh`` field; it contains the same value.
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
v2:
* Fixed typo in commit message.
* Release notes: No need to mention added cache guard. (AI)
* Release notes: Added note about flushthresh removal
under removed items. (AI)
* Added note about 16-byte alignment of stats. (AI)
v3:
* Moved documentated changes from ABI to API section.
Formally, the rte_mempool_cache structure is public,
as it is not marked as private.
* Rebased for CI.
---
doc/guides/rel_notes/release_26_11.rst | 6 ++++++
drivers/net/sxe2/sxe2_txrx_vec_avx512.c | 2 +-
lib/mempool/mempool_trace.h | 1 -
lib/mempool/rte_mempool.c | 8 ++------
lib/mempool/rte_mempool.h | 16 +++++-----------
5 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
index c8cc86295d..e31325585a 100644
--- a/doc/guides/rel_notes/release_26_11.rst
+++ b/doc/guides/rel_notes/release_26_11.rst
@@ -68,6 +68,8 @@ Removed Items
Also, make sure to start the actual text at the margin.
=======================================================
+* mempool: The obsolete ``flushthresh`` field was removed from the ``rte_mempool_cache`` structure.
+
* Removed deprecated symbols:
* fib: ``RTE_FIB6_IPV6_ADDR_SIZE``, ``RTE_FIB6_MAXDEPTH``
@@ -93,6 +95,10 @@ API Changes
Also, make sure to start the actual text at the margin.
=======================================================
+* mempool: The ``rte_mempool_cache`` structure was updated as follows:
+ - The obsolete ``flushthresh`` field was removed.
+ - The size of the ``objs`` array was reduced from ``RTE_MEMPOOL_CACHE_MAX_SIZE`` * 2 to ``RTE_MEMPOOL_CACHE_MAX_SIZE``.
+
ABI Changes
-----------
diff --git a/drivers/net/sxe2/sxe2_txrx_vec_avx512.c b/drivers/net/sxe2/sxe2_txrx_vec_avx512.c
index a830c7a33b..2e680f4027 100644
--- a/drivers/net/sxe2/sxe2_txrx_vec_avx512.c
+++ b/drivers/net/sxe2/sxe2_txrx_vec_avx512.c
@@ -67,7 +67,7 @@ static __rte_always_inline int32_t sxe2_tx_bufs_free_vec_avx512(struct sxe2_tx_q
}
cache->len += rs_thresh;
- if (cache->len >= cache->flushthresh) {
+ if (cache->len >= cache->size) {
(void)rte_mempool_ops_enqueue_bulk(mp,
&cache->objs[cache->size], cache->len - cache->size);
cache->len = cache->size;
diff --git a/lib/mempool/mempool_trace.h b/lib/mempool/mempool_trace.h
index 23cda1473c..60e47cf67b 100644
--- a/lib/mempool/mempool_trace.h
+++ b/lib/mempool/mempool_trace.h
@@ -119,7 +119,6 @@ RTE_TRACE_POINT(
rte_trace_point_emit_i32(socket_id);
rte_trace_point_emit_ptr(cache);
rte_trace_point_emit_u32(cache->len);
- rte_trace_point_emit_u32(cache->flushthresh);
)
RTE_TRACE_POINT(
diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index 817e2b8dc1..09660e89ac 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -753,7 +753,6 @@ static void
mempool_cache_init(struct rte_mempool_cache *cache, uint32_t size)
{
cache->size = size;
- cache->flushthresh = size; /* Obsolete; for API/ABI compatibility purposes only */
cache->len = 0;
}
@@ -1197,6 +1196,7 @@ mempool_obj_audit(struct rte_mempool *mp, __rte_unused void *opaque,
RTE_MEMPOOL_CHECK_COOKIES(mp, &obj, 1, 2);
}
+/* check cookies before and after objects */
static void
mempool_audit_cookies(struct rte_mempool *mp)
{
@@ -1213,11 +1213,10 @@ mempool_audit_cookies(struct rte_mempool *mp)
#define mempool_audit_cookies(mp) do {} while(0)
#endif
-/* check cookies before and after objects */
+/* check cache size consistency */
static void
mempool_audit_cache(const struct rte_mempool *mp)
{
- /* check cache size consistency */
unsigned lcore_id;
if (mp->cache_size == 0)
@@ -1241,9 +1240,6 @@ rte_mempool_audit(struct rte_mempool *mp)
{
mempool_audit_cache(mp);
mempool_audit_cookies(mp);
-
- /* For case where mempool DEBUG is not set, and cache size is 0 */
- RTE_SET_USED(mp);
}
/* dump the status of the mempool on the console */
diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
index 50d958c7c6..2fa70812d5 100644
--- a/lib/mempool/rte_mempool.h
+++ b/lib/mempool/rte_mempool.h
@@ -89,14 +89,14 @@ struct __rte_cache_aligned rte_mempool_debug_stats {
*/
struct __rte_cache_aligned rte_mempool_cache {
uint32_t size; /**< Size of the cache */
- uint32_t flushthresh; /**< Obsolete; for API/ABI compatibility purposes only */
uint32_t len; /**< Current cache count */
#ifdef RTE_LIBRTE_MEMPOOL_STATS
- uint32_t unused;
/*
* Alternative location for the most frequently updated mempool statistics (per-lcore),
* providing faster update access when using a mempool cache.
+ * Note: 16-byte aligned for optimal SIMD access, when updating pairs of counters.
*/
+ alignas(16)
struct {
uint64_t put_bulk; /**< Number of puts. */
uint64_t put_objs; /**< Number of objects successfully put. */
@@ -104,15 +104,9 @@ struct __rte_cache_aligned rte_mempool_cache {
uint64_t get_success_objs; /**< Objects successfully allocated. */
} stats; /**< Statistics */
#endif
- /**
- * Cache objects
- *
- * Note:
- * Cache is allocated at double size for API/ABI compatibility purposes only.
- * When reducing its size at an API/ABI breaking release,
- * remember to add a cache guard after it.
- */
- alignas(RTE_CACHE_LINE_SIZE) void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE * 2];
+ /** Cache objects */
+ alignas(RTE_CACHE_LINE_SIZE) void *objs[RTE_MEMPOOL_CACHE_MAX_SIZE];
+ RTE_CACHE_GUARD;
};
/**
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH v3] mempool: remove cache flush threshold field
2026-08-06 15:45 ` [PATCH v3] " Morten Brørup
@ 2026-08-07 7:00 ` Morten Brørup
2026-08-10 6:16 ` Morten Brørup
0 siblings, 1 reply; 6+ messages in thread
From: Morten Brørup @ 2026-08-07 7:00 UTC (permalink / raw)
To: dev
Recheck-request: iol-unit-arm64-testing, github-robot
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v3] mempool: remove cache flush threshold field
2026-08-07 7:00 ` Morten Brørup
@ 2026-08-10 6:16 ` Morten Brørup
0 siblings, 0 replies; 6+ messages in thread
From: Morten Brørup @ 2026-08-10 6:16 UTC (permalink / raw)
To: dev
Recheck-request: iol-unit-arm64-testing
Failure not related to patch.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-10 6:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-24 12:07 [PATCH] mempool: remove cache flush threshold Morten Brørup
2026-07-24 13:35 ` Andrew Rybchenko
2026-07-24 15:14 ` [PATCH v2] mempool: remove cache flush threshold field Morten Brørup
2026-08-06 15:45 ` [PATCH v3] " Morten Brørup
2026-08-07 7:00 ` Morten Brørup
2026-08-10 6:16 ` Morten Brørup
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox