From 642527d72a049a08caa899d25c606438e5db2c2b Mon Sep 17 00:00:00 2001 From: Kozlowski Mateusz Date: Fri, 12 Mar 2021 15:28:02 +0100 Subject: [PATCH] ref count alignment Move ref counts to their own cacheline - otherwise they pollute and cause false sharing to fields nearby and cause a lot of cache bouncing between physical CPUs. Signed-off-by: Kozlowski Mateusz --- src/ocf_cache_priv.h | 6 +++--- src/ocf_volume_priv.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ocf_cache_priv.h b/src/ocf_cache_priv.h index 1513c2e..3a1bf27 100644 --- a/src/ocf_cache_priv.h +++ b/src/ocf_cache_priv.h @@ -91,12 +91,12 @@ struct ocf_cache { struct { /* cache get/put counter */ - struct ocf_refcnt cache; + struct ocf_refcnt cache __attribute__((aligned(64))); /* # of requests potentially dirtying cachelines */ - struct ocf_refcnt dirty; + struct ocf_refcnt dirty __attribute__((aligned(64))); /* # of requests accessing attached metadata, excluding * management reqs */ - struct ocf_refcnt metadata; + struct ocf_refcnt metadata __attribute__((aligned(64))); } refcnt; ocf_pipeline_t stop_pipeline; diff --git a/src/ocf_volume_priv.h b/src/ocf_volume_priv.h index 0418d75..5661b57 100644 --- a/src/ocf_volume_priv.h +++ b/src/ocf_volume_priv.h @@ -32,7 +32,7 @@ struct ocf_volume { unsigned discard_zeroes:1; /* true if reading discarded pages returns 0 */ } features; - struct ocf_refcnt refcnt; + struct ocf_refcnt refcnt __attribute__((aligned(64))); } __attribute__((aligned(64))); int ocf_volume_type_init(struct ocf_volume_type **type,