[v2] reorder: improve buffer structure layout

Message ID 20230417091233.1406974-1-vfialko@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] reorder: improve buffer structure layout |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Volodymyr Fialko April 17, 2023, 9:12 a.m. UTC
  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(-)
  

Comments

Thomas Monjalon June 1, 2023, 3:19 p.m. UTC | #1
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.
  

Patch

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