On 24/05/2024 13:20, Morten Brørup wrote: >> From: Paul Szczepanek [mailto:paul.szczepa...@arm.com] >> Sent: Friday, 24 May 2024 10.37 >> >> +size_t rte_mempool_get_obj_alignment(struct rte_mempool *mp) >> +{ >> + if (mp == NULL) >> + return 0; >> + >> + if (mp->flags & RTE_MEMPOOL_F_NO_CACHE_ALIGN) >> + return sizeof(uint64_t); >> + else >> + return RTE_MEMPOOL_ALIGN; >> +} > > The object alignment depends on the underlying mempool driver. You cannot > assume that it is either sizeof(uint64_t) or cache line aligned. > > Refer to the calc_mem_size driver operation, which also provides object > alignment information: > https://elixir.bootlin.com/dpdk/v24.03/source/lib/mempool/rte_mempool.h#L529 > > If you need this function, you need to add a new driver operation, and your > function above can be the default for this operation, like for the the > calc_mem_size driver operation: > https://elixir.bootlin.com/dpdk/v24.03/source/lib/mempool/rte_mempool_ops.c#L120 >
As discussed on slack the alignment you mention is the memzone alignment which is distinct from the object alignment which is enforced by the mempool according to the RTE_MEMPOOL_F_NO_CACHE_ALIGN flag. Objects may have higher alignment, the alignment returned by the new function is the minimum guaranteed one. I addressed your other comments in v12 (pending internal review).