Merge pull request #744 from mmkayPL/cacheline-alignment

Cacheline alignment
This commit is contained in:
Michał Mielewczyk 2021-03-26 12:02:45 +01:00 committed by GitHub
commit a7553fecee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 18 deletions

View File

@ -30,7 +30,7 @@ struct cas_classifier {
struct workqueue_struct *wq;
/* Lock for rules list */
rwlock_t lock;
rwlock_t lock __attribute__((aligned(64)));
};
struct cas_cls_condition_handler;

View File

@ -192,8 +192,8 @@ static int _cas_upgrade_dump_cache_conf_main(ocf_cache_t cache,
}
struct _ocf_core_visitor_ctx {
int i;
struct cas_properties *cache_props;
int i;
int error;
};
@ -710,9 +710,9 @@ static int _cas_upgrade_init_props_array(
}
struct _cas_cache_dump_conf_visitor_ctx {
int i;
struct cas_properties **caches_props_array;
struct casdsk_props_conf *caches_serialized_conf;
int i;
int error;
};

View File

@ -14,16 +14,16 @@ struct _env_allocator {
/*!< Memory pool ID unique name */
char *name;
/*!< Size of specific item of memory pool */
uint32_t item_size;
/*!< OS handle to memory pool */
struct kmem_cache *kmem_cache;
/*!< Number of currently allocated items in pool */
atomic_t count;
struct cas_reserve_pool *rpool;
/*!< Size of specific item of memory pool */
uint32_t item_size;
/*!< Number of currently allocated items in pool */
atomic_t count __attribute__((aligned(64)));
};
static inline size_t env_allocator_align(size_t size)

View File

@ -9,14 +9,14 @@
#define MAX_THREAD_NAME_SIZE 48
struct cas_thread_info {
char name[MAX_THREAD_NAME_SIZE];
void *sync_data;
atomic_t stop;
atomic_t kicked;
struct completion compl;
struct completion sync_compl;
void *sync_data;
wait_queue_head_t wq;
atomic_t kicked;
struct task_struct *thread;
char name[MAX_THREAD_NAME_SIZE];
};
static int _cas_io_queue_thread(void *data)

View File

@ -7,12 +7,12 @@
#include "ocf_env.h"
struct env_mpool {
int mpool_max;
/*!< Max mpool allocation order */
env_allocator *allocator[env_mpool_max];
/*!< OS handle to memory pool */
int mpool_max;
/*!< Max mpool allocation order */
uint32_t hdr_size;
/*!< Data header size (constant allocation part) */

View File

@ -25,25 +25,31 @@
#define CAS_DEBUG_PARAM(format, ...)
#endif
/* This is currently 24B padded/force aligned to 32B.
* With a 64B cacheline this means two structs on different cores may
* invalidate each other. This shouldn't happen between different physical
* CPUs and cause false sharing though, since with an even number of cores
* per CPU same cacheline shouldn't be polluted from the other physical CPU.
* */
struct _cas_reserve_pool_per_cpu {
spinlock_t lock;
struct list_head list;
atomic_t count;
};
} __attribute__((__aligned__(32)));
struct cas_reserve_pool {
uint32_t limit;
char *name;
uint32_t entry_size;
char *name;
struct _cas_reserve_pool_per_cpu *rpools;
};
struct _cas_rpool_pre_alloc_info {
struct work_struct ws;
struct completion cmpl;
struct cas_reserve_pool *rpool_master;
cas_rpool_new rpool_new;
void *allocator_ctx;
struct completion cmpl;
int error;
};