allocate fixed map status alongside request struct

It is wastefull to allocate a full 1B to store 1 bit of
alock status per cacheline. Fixed allocation of 128 bits
seems more reasonable.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2022-08-26 06:47:26 +02:00
parent 2f3e0b0fd0
commit 0cfb8077c5

View File

@ -59,8 +59,13 @@ static inline size_t ocf_req_sizeof_alock_status(uint32_t lines)
int ocf_req_allocator_init(struct ocf_ctx *ocf_ctx) int ocf_req_allocator_init(struct ocf_ctx *ocf_ctx)
{ {
ocf_ctx->resources.req = env_mpool_create(sizeof(struct ocf_request), enum ocf_req_size max_req_size = ocf_req_size_128;
sizeof(struct ocf_map_info) + sizeof(uint8_t), ENV_MEM_NORMAL, ocf_req_size_128, size_t alock_status_size = ocf_req_sizeof_alock_status(
(1U << (unsigned)max_req_size));
size_t header_size = sizeof(struct ocf_request) + alock_status_size;
ocf_ctx->resources.req = env_mpool_create(header_size,
sizeof(struct ocf_map_info), ENV_MEM_NORMAL, max_req_size,
false, NULL, "ocf_req", true); false, NULL, "ocf_req", true);
if (ocf_ctx->resources.req == NULL) if (ocf_ctx->resources.req == NULL)