Skip to content

Commit

Permalink
prov/shm: adjust the order of smr_region fields.
Browse files Browse the repository at this point in the history
xpmem is a opt-in feature and not enabled by default.
The previous commit e0906f6 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 <[email protected]>
  • Loading branch information
shijin-aws committed Jan 19, 2024
1 parent e16f28a commit b069cb4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions prov/shm/src/smr_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit b069cb4

Please sign in to comment.