[PATCH] reorder: improve buffer structure layout
Tyler Retzlaff
roretzla at linux.microsoft.com
Fri Apr 14 19:07:16 CEST 2023
On Fri, Apr 14, 2023 at 10:26:26AM +0100, Bruce Richardson wrote:
> On Fri, Apr 14, 2023 at 10:43:43AM +0200, Volodymyr Fialko wrote:
> > Rearrange the reorder buffer structure to prevent padding to extra one
> > cache line.
> >
> > Current layout:
> > struct rte_reorder_buffer {
> > char name[RTE_REORDER_NAMESIZE];
> > uint32_t min_seqn;
> > unsigned int memsize;
> > // -> padding to cache align (cir_buffer is also cache aligned)
> > struct cir_buffer ready_buf;
> > struct cir_buffer order_buf;
> > int is_initialized;
> > // -> padding to cache align, eat whole line
> > };
> >
> > New layout:
> > struct rte_reorder_buffer {
> > char name[RTE_REORDER_NAMESIZE];
> > uint32_t min_seqn;
> > unsigned int memsize;
> > int is_initialized;
> > // -> padding to cache align (cir_buffer is also cache aligned)
> > struct cir_buffer ready_buf;
> > struct cir_buffer order_buf;
> > // -> no padding
> > };
> >
> > Signed-off-by: Volodymyr Fialko <vfialko at marvell.com>
> > ---
>
> Acked-by: Bruce Richardson <bruce.richardson at intel.com>
>
> > lib/reorder/rte_reorder.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c
> > index f55f383700..7418202b04 100644
> > --- a/lib/reorder/rte_reorder.c
> > +++ b/lib/reorder/rte_reorder.c
> > @@ -46,9 +46,10 @@ struct rte_reorder_buffer {
> > char name[RTE_REORDER_NAMESIZE];
> > uint32_t min_seqn; /**< Lowest seq. number that can be in the buffer */
> > unsigned int memsize; /**< memory area size of reorder buffer */
> > + int is_initialized; /**< flag indicates that buffer was initialized */
> > +
>
> Since we are moving it, it might be an opportunity to change it from "int"
> to "bool".
+1
>
> > struct cir_buffer ready_buf; /**< temp buffer for dequeued entries */
> > struct cir_buffer order_buf; /**< buffer used to reorder entries */
> > - int is_initialized;
> > } __rte_cache_aligned;
> >
> > static void
> > --
> > 2.34.1
> >
More information about the dev
mailing list