aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Soheil Hassas Yeganeh <soheil@google.com>2018-10-19 13:05:35 -0400
committerGravatar Soheil Hassas Yeganeh <soheil@google.com>2018-10-19 13:05:35 -0400
commit1f85f6ba33af282530e28c8e6a7dbaae0da8faed (patch)
tree1921da6632d029d04b91444dafbcd1da0a39d3f8 /src
parent20c848e88d3356195fa70dbb4fe1afee271b735a (diff)
Do not waste cache lines with unnecessary paddings.
Make sure paddings are GPR_CACHELINE_SIZE minus the size of fields in that cache line. Otherwise, we will waste an additional cache line for no good reason.
Diffstat (limited to 'src')
-rw-r--r--src/core/lib/gpr/mpscq.h2
-rw-r--r--src/core/lib/iomgr/ev_epoll1_linux.cc2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/core/lib/gpr/mpscq.h b/src/core/lib/gpr/mpscq.h
index 6b67880d1b..dac2801b4e 100644
--- a/src/core/lib/gpr/mpscq.h
+++ b/src/core/lib/gpr/mpscq.h
@@ -40,7 +40,7 @@ typedef struct gpr_mpscq_node {
typedef struct gpr_mpscq {
gpr_atm head;
// make sure head & tail don't share a cacheline
- char padding[GPR_CACHELINE_SIZE];
+ char padding[GPR_CACHELINE_SIZE - sizeof(head)];
gpr_mpscq_node* tail;
gpr_mpscq_node stub;
} gpr_mpscq;
diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc
index 6ef889b0fe..0f58b4a63e 100644
--- a/src/core/lib/iomgr/ev_epoll1_linux.cc
+++ b/src/core/lib/iomgr/ev_epoll1_linux.cc
@@ -195,7 +195,7 @@ struct grpc_pollset_worker {
typedef struct pollset_neighborhood {
gpr_mu mu;
grpc_pollset* active_root;
- char pad[GPR_CACHELINE_SIZE];
+ char pad[GPR_CACHELINE_SIZE - sizeof(mu) - sizeof(active_root)];
} pollset_neighborhood;
struct grpc_pollset {