* [PATCH] reorder: improve buffer structure layout
@ 2023-04-14 8:43 Volodymyr Fialko
2023-04-14 9:26 ` Bruce Richardson
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Volodymyr Fialko @ 2023-04-14 8:43 UTC (permalink / raw)
To: dev, Reshma Pattan; +Cc: jerinj, anoobj, Volodymyr Fialko
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@marvell.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 */
+
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] reorder: improve buffer structure layout
2023-04-14 8:43 [PATCH] reorder: improve buffer structure layout Volodymyr Fialko
@ 2023-04-14 9:26 ` Bruce Richardson
2023-04-14 17:07 ` Tyler Retzlaff
2023-04-14 14:52 ` Stephen Hemminger
2023-04-17 9:12 ` [PATCH v2] " Volodymyr Fialko
2 siblings, 1 reply; 8+ messages in thread
From: Bruce Richardson @ 2023-04-14 9:26 UTC (permalink / raw)
To: Volodymyr Fialko; +Cc: dev, Reshma Pattan, jerinj, anoobj
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@marvell.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@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".
> 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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] reorder: improve buffer structure layout
2023-04-14 9:26 ` Bruce Richardson
@ 2023-04-14 17:07 ` Tyler Retzlaff
0 siblings, 0 replies; 8+ messages in thread
From: Tyler Retzlaff @ 2023-04-14 17:07 UTC (permalink / raw)
To: Bruce Richardson; +Cc: Volodymyr Fialko, dev, Reshma Pattan, jerinj, anoobj
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@marvell.com>
> > ---
>
> Acked-by: Bruce Richardson <bruce.richardson@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
> >
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] reorder: improve buffer structure layout
2023-04-14 8:43 [PATCH] reorder: improve buffer structure layout Volodymyr Fialko
2023-04-14 9:26 ` Bruce Richardson
@ 2023-04-14 14:52 ` Stephen Hemminger
2023-04-14 14:54 ` Bruce Richardson
2023-04-17 9:12 ` [PATCH v2] " Volodymyr Fialko
2 siblings, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2023-04-14 14:52 UTC (permalink / raw)
To: Volodymyr Fialko; +Cc: dev, Reshma Pattan, jerinj, anoobj
On Fri, 14 Apr 2023 10:43:43 +0200
Volodymyr Fialko <vfialko@marvell.com> wrote:
> 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 */
> +
> 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
Since this is ABI change it will have to wait for 23.11 release
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] reorder: improve buffer structure layout
2023-04-14 14:52 ` Stephen Hemminger
@ 2023-04-14 14:54 ` Bruce Richardson
2023-04-14 15:30 ` Stephen Hemminger
0 siblings, 1 reply; 8+ messages in thread
From: Bruce Richardson @ 2023-04-14 14:54 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Volodymyr Fialko, dev, Reshma Pattan, jerinj, anoobj
On Fri, Apr 14, 2023 at 07:52:30AM -0700, Stephen Hemminger wrote:
> On Fri, 14 Apr 2023 10:43:43 +0200
> Volodymyr Fialko <vfialko@marvell.com> wrote:
>
> > 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 */
> > +
> > 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
>
> Since this is ABI change it will have to wait for 23.11 release
It shouldn't be an ABI change. This struct is defined in a C file, rather
than a header, so is not exposed to end applications.
/Bruce
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] reorder: improve buffer structure layout
2023-04-14 14:54 ` Bruce Richardson
@ 2023-04-14 15:30 ` Stephen Hemminger
0 siblings, 0 replies; 8+ messages in thread
From: Stephen Hemminger @ 2023-04-14 15:30 UTC (permalink / raw)
To: Bruce Richardson; +Cc: Volodymyr Fialko, dev, Reshma Pattan, jerinj, anoobj
On Fri, 14 Apr 2023 15:54:13 +0100
Bruce Richardson <bruce.richardson@intel.com> wrote:
> On Fri, Apr 14, 2023 at 07:52:30AM -0700, Stephen Hemminger wrote:
> > On Fri, 14 Apr 2023 10:43:43 +0200
> > Volodymyr Fialko <vfialko@marvell.com> wrote:
> >
> > > 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 */
> > > +
> > > 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
> >
> > Since this is ABI change it will have to wait for 23.11 release
>
> It shouldn't be an ABI change. This struct is defined in a C file, rather
> than a header, so is not exposed to end applications.
>
> /Bruce
Sorry, Bruce is right.
You might want to use uint8_t or bool for a simple flag.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] reorder: improve buffer structure layout
2023-04-14 8:43 [PATCH] reorder: improve buffer structure layout Volodymyr Fialko
2023-04-14 9:26 ` Bruce Richardson
2023-04-14 14:52 ` Stephen Hemminger
@ 2023-04-17 9:12 ` Volodymyr Fialko
2023-06-01 15:19 ` Thomas Monjalon
2 siblings, 1 reply; 8+ messages in thread
From: Volodymyr Fialko @ 2023-04-17 9:12 UTC (permalink / raw)
To: dev, Reshma Pattan
Cc: jerinj, anoobj, bruce.richardson, stephen, roretzla, Volodymyr Fialko
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;
bool 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@marvell.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
v2:
- changed flag type to `bool`
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..4de1aa4056 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 */
+ bool is_initialized; /**< flag indicates that buffer was initialized */
+
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] reorder: improve buffer structure layout
2023-04-17 9:12 ` [PATCH v2] " Volodymyr Fialko
@ 2023-06-01 15:19 ` Thomas Monjalon
0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2023-06-01 15:19 UTC (permalink / raw)
To: Volodymyr Fialko
Cc: dev, Reshma Pattan, jerinj, anoobj, bruce.richardson, stephen, roretzla
17/04/2023 11:12, Volodymyr Fialko:
> 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;
> bool 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@marvell.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-06-01 15:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 8:43 [PATCH] reorder: improve buffer structure layout Volodymyr Fialko
2023-04-14 9:26 ` Bruce Richardson
2023-04-14 17:07 ` Tyler Retzlaff
2023-04-14 14:52 ` Stephen Hemminger
2023-04-14 14:54 ` Bruce Richardson
2023-04-14 15:30 ` Stephen Hemminger
2023-04-17 9:12 ` [PATCH v2] " Volodymyr Fialko
2023-06-01 15:19 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).