From b069cb494dc411f1cba9b8f66292c142862da254 Mon Sep 17 00:00:00 2001 From: Shi Jin Date: Fri, 19 Jan 2024 01:42:20 +0000 Subject: [PATCH] prov/shm: adjust the order of smr_region fields. xpmem is a opt-in feature and not enabled by default. The previous commit e0906f6f inserts xpmem related fields in the middle of smr_region struct, which makes the size of smr_region struct increase from 104 (2 cache lines) to 144 ( 3 cache lines). xpmem_cap_self, xpmem_self, and xpmem_peer are not used in fast path while they make the fields (offsets) used in the fast path shifted to the next cache line and causes more cache misses. This patch moves the xpmem fields to the end of the struct to fix this issue. Signed-off-by: Shi Jin --- prov/shm/src/smr_util.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/prov/shm/src/smr_util.h b/prov/shm/src/smr_util.h index 6a32d1075f8..369cbcab90a 100644 --- a/prov/shm/src/smr_util.h +++ b/prov/shm/src/smr_util.h @@ -226,9 +226,6 @@ struct smr_region { uint8_t cma_cap_peer; uint8_t cma_cap_self; uint32_t max_sar_buf_per_peer; - uint8_t xpmem_cap_self; - struct xpmem_pinfo xpmem_self; - struct xpmem_pinfo xpmem_peer; void *base_addr; pthread_spinlock_t lock; /* lock for shm access if both ep->tx_lock and this lock need to @@ -247,6 +244,10 @@ struct smr_region { size_t peer_data_offset; size_t name_offset; size_t sock_name_offset; + + uint8_t xpmem_cap_self; + struct xpmem_pinfo xpmem_self; + struct xpmem_pinfo xpmem_peer; }; struct smr_resp {