Skip to content

[PATCH v2] linux-gen: pool: optimize single event alloc/free operations#2318

Merged
MatiasElo merged 3 commits intoOpenDataPlane:masterfrom
MatiasElo:dev/single-alloc-free-opt
Mar 18, 2026
Merged

[PATCH v2] linux-gen: pool: optimize single event alloc/free operations#2318
MatiasElo merged 3 commits intoOpenDataPlane:masterfrom
MatiasElo:dev/single-alloc-free-opt

Conversation

@MatiasElo
Copy link
Copy Markdown
Collaborator

No description provided.

@odpbuild odpbuild changed the title linux-gen: pool: optimize single event alloc/free operations [PATCH v1] linux-gen: pool: optimize single event alloc/free operations Feb 25, 2026
@MatiasElo MatiasElo added this to the v1.50.0 milestone Mar 12, 2026
Comment thread platform/linux-generic/odp_pool.c
Comment on lines +1474 to +1485
if (odp_unlikely(cache_size == cache_num)) {
const uint32_t burst = pool->burst_size;
_odp_event_hdr_t *ev_hdr[burst];
ring_mpmc_rst_ptr_t *ring = &pool->ring->hdr;
uint32_t mask = pool->ring_mask;

cache_pop(cache, ev_hdr, burst);

ring_mpmc_rst_ptr_enq_multi(ring, mask, (void **)ev_hdr, burst);
if (CONFIG_POOL_STATISTICS && pool->params.stats.bit.free_ops)
odp_atomic_inc_u64(&pool->stats.free_ops);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder which is more optimal, keep cache full for subsequent allocations and free the single event to global pool vs. this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe flush half the cache or so to the global pool,?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The burst size comes from a config file option (pool:burst_size), so I'd prefer keeping it as is for now.

Comment thread platform/linux-generic/odp_pool.c Outdated
Optimize implementation of internal single event specific _odp_event_free()
function, which is used to implement several API functions.

Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Optimize implementation of internal single event specific
_odp_event_alloc() function, which is used to implement several API
functions.

Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Use single event alloc function in odp_buffer_alloc() implementation.

Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
@MatiasElo MatiasElo force-pushed the dev/single-alloc-free-opt branch from 565e9ff to 1197f87 Compare March 18, 2026 06:24
@odpbuild odpbuild changed the title [PATCH v1] linux-gen: pool: optimize single event alloc/free operations [PATCH v2] linux-gen: pool: optimize single event alloc/free operations Mar 18, 2026
@MatiasElo MatiasElo merged commit ff1cd82 into OpenDataPlane:master Mar 18, 2026
164 checks passed
@MatiasElo MatiasElo deleted the dev/single-alloc-free-opt branch March 18, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants