diff mbox series

[API-NEXT,v1,13/19] linux-gen: buffer: optimize header layout

Message ID 1505422809-5632-14-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v1,1/19] travis: fix powerpc test name | expand

Commit Message

Github ODP bot Sept. 14, 2017, 9 p.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Pack most often used buffer header fields (including seg[0])
into the first cache line.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
/** Email created from pull request 179 (muvarov:api-next)
 ** https://github.com/Linaro/odp/pull/179
 ** Patch: https://github.com/Linaro/odp/pull/179.patch
 ** Base sha: 6b6253c30f88c80bf632436ff06c1b000860a2f1
 ** Merge commit sha: ada61f5ba5f940d03a95893940c21028d4c75d19
 **/
 .../linux-generic/include/odp_buffer_internal.h    | 43 ++++++++++++----------
 1 file changed, 24 insertions(+), 19 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h
index 309094658..0c873d2d2 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -43,41 +43,46 @@  typedef struct seg_entry_t {
 
 /* Common buffer header */
 struct odp_buffer_hdr_t {
-	/* Buffer index in the pool */
-	uint32_t index;
 
-	/* Initial buffer data pointer and length */
-	uint8_t  *base_data;
-	uint8_t  *buf_end;
+	/* Buffer index in the pool */
+	uint32_t  index;
 
-	/* Max data size */
-	uint32_t  size;
+	/* Total segment count */
+	uint16_t  segcount;
 
 	/* Pool type */
 	int8_t    type;
 
-	/* Burst counts */
-	uint8_t   burst_num;
-	uint8_t   burst_first;
-
 	/* Number of seg[] entries used */
 	uint8_t   num_seg;
 
-	/* Total segment count */
-	uint32_t  segcount;
-
 	/* Next header which continues the segment list */
 	void *next_seg;
 
 	/* Last header of the segment list */
 	void *last_seg;
 
+	/* Initial buffer data pointer and length */
+	uint8_t  *base_data;
+	uint8_t  *buf_end;
+
+	/* --- 40 bytes --- */
+
 	/* Segments */
 	seg_entry_t seg[CONFIG_PACKET_MAX_SEGS];
 
+	/* Burst counts */
+	uint8_t   burst_num;
+	uint8_t   burst_first;
+
 	/* Next buf in a list */
 	struct odp_buffer_hdr_t *next;
 
+	/* Burst table */
+	struct odp_buffer_hdr_t *burst[BUFFER_BURST_SIZE];
+
+	/* --- Mostly read only data --- */
+
 	/* User context pointer or u64 */
 	union {
 		uint64_t    buf_u64;
@@ -85,6 +90,9 @@  struct odp_buffer_hdr_t {
 		const void *buf_cctx; /* const alias for ctx */
 	};
 
+	/* Pool pointer */
+	void *pool_ptr;
+
 	/* User area pointer */
 	void    *uarea_addr;
 
@@ -94,9 +102,6 @@  struct odp_buffer_hdr_t {
 	/* Event type. Maybe different than pool type (crypto compl event) */
 	int8_t    event_type;
 
-	/* Burst table */
-	struct odp_buffer_hdr_t *burst[BUFFER_BURST_SIZE];
-
 	/* ipc mapped process can not walk over pointers,
 	 * offset has to be used */
 	uint64_t ipc_data_offset;
@@ -105,8 +110,8 @@  struct odp_buffer_hdr_t {
 	 * inlining */
 	odp_pool_t pool_hdl;
 
-	/* Pool pointer */
-	void *pool_ptr;
+	/* Max data size */
+	uint32_t size;
 
 	/* Data or next header */
 	uint8_t data[0];