Merge pull request #16943 from soheilhy/worktree-cache

Do not waste cache lines with unnecessary paddings.
reviewable/pr16773/r4
Soheil Hassas Yeganeh 7 years ago committed by GitHub
commit 397f20742f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/core/lib/gpr/mpscq.h
  2. 10
      src/core/lib/iomgr/ev_epoll1_linux.cc

@ -38,9 +38,11 @@ typedef struct gpr_mpscq_node {
// Actual queue type
typedef struct gpr_mpscq {
gpr_atm head;
// make sure head & tail don't share a cacheline
char padding[GPR_CACHELINE_SIZE];
union {
char padding[GPR_CACHELINE_SIZE];
gpr_atm head;
};
gpr_mpscq_node* tail;
gpr_mpscq_node stub;
} gpr_mpscq;

@ -193,9 +193,13 @@ struct grpc_pollset_worker {
#define MAX_NEIGHBORHOODS 1024
typedef struct pollset_neighborhood {
gpr_mu mu;
grpc_pollset* active_root;
char pad[GPR_CACHELINE_SIZE];
union {
char pad[GPR_CACHELINE_SIZE];
struct {
gpr_mu mu;
grpc_pollset* active_root;
};
};
} pollset_neighborhood;
struct grpc_pollset {

Loading…
Cancel
Save