From da9a6204d35e4aec5a41f8ff64b7523384332960 Mon Sep 17 00:00:00 2001 From: Kozlowski Mateusz Date: Tue, 16 Mar 2021 10:11:08 +0100 Subject: [PATCH] General structure packing Pack often used structures, so that less memory/cachelines are used Signed-off-by: Kozlowski Mateusz --- modules/cas_cache/layer_upgrade.c | 4 ++-- modules/cas_cache/threads.c | 6 +++--- modules/cas_cache/utils/utils_mpool.c | 6 +++--- modules/cas_cache/utils/utils_rpool.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/cas_cache/layer_upgrade.c b/modules/cas_cache/layer_upgrade.c index f8750ce..7500e3a 100644 --- a/modules/cas_cache/layer_upgrade.c +++ b/modules/cas_cache/layer_upgrade.c @@ -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; }; diff --git a/modules/cas_cache/threads.c b/modules/cas_cache/threads.c index 8f4f1ca..ca3ef92 100644 --- a/modules/cas_cache/threads.c +++ b/modules/cas_cache/threads.c @@ -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) diff --git a/modules/cas_cache/utils/utils_mpool.c b/modules/cas_cache/utils/utils_mpool.c index 34b0ec0..3ca1ede 100644 --- a/modules/cas_cache/utils/utils_mpool.c +++ b/modules/cas_cache/utils/utils_mpool.c @@ -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) */ diff --git a/modules/cas_cache/utils/utils_rpool.c b/modules/cas_cache/utils/utils_rpool.c index 085b21c..b431064 100644 --- a/modules/cas_cache/utils/utils_rpool.c +++ b/modules/cas_cache/utils/utils_rpool.c @@ -39,17 +39,17 @@ struct _cas_reserve_pool_per_cpu { 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; };