[v2,6/11] linux-gen: buffer: optimize header layout

Message ID 1505221212-27163-7-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series
  • [v2,1/11] linux-gen: packet: roll back to copy based references
Related show

Commit Message

Github ODP bot Sept. 12, 2017, 1 p.m.
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>

---
/** Email created from pull request 170 (psavol:master-packet-ref-rework)
 ** https://github.com/Linaro/odp/pull/170
 ** Patch: https://github.com/Linaro/odp/pull/170.patch
 ** Base sha: fb3f36cec108ce9c55241d9f0e66d4832a552b8a
 ** Merge commit sha: bab9e010b5432ba0f2ff0651313a85a6a1b563c2
 **/
 .../linux-generic/include/odp_buffer_internal.h    | 43 ++++++++++++----------
 1 file changed, 24 insertions(+), 19 deletions(-)

Patch

diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h
index 30909465..0c873d2d 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];