[Tarantool-patches] [PATCH small 1/1] test: don't use not aligned size for mempool

Sergey Ostanevich sergos at tarantool.org
Sun Jun 21 13:06:03 MSK 2020


LGTM.

I wonder how big is impact of all alignment activities? Can you consult with Mons to obtain a reference test?

Best regards,
Sergos 

Saturday, 20 June 2020, 21:01 +0300 from Vladislav Shpilevoy  <v.shpilevoy at tarantool.org>:
>Mempool expects aligned object size. Because it uses the free
>blocks to store metadata in them, in a struct mslab. Which needs
>alignment.
>
>Part of  https://github.com/tarantool/tarantool/issues/5063
>---
>Branch:  http://github.com/tarantool/small/tree/gerold103/tarantool/gh-5063-not-aligned-test
>Issue:  https://github.com/tarantool/tarantool/issues/5063
>
> test/mempool.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
>diff --git a/test/mempool.c b/test/mempool.c
>index 298ba17..65eabaf 100644
>--- a/test/mempool.c
>+++ b/test/mempool.c
>@@ -1,3 +1,4 @@
>+#include "trivia/util.h"
> #include <small/mempool.h>
> #include <small/quota.h>
> #include <stdio.h>
>@@ -121,6 +122,12 @@ int main()
> 	objsize = rand() % OBJSIZE_MAX;
> 	if (objsize < OBJSIZE_MIN)
> 		objsize = OBJSIZE_MIN;
>+	/*
>+	 * Mempool does not work with not aligned sizes. Because
>+	 * it utilizes the unused blocks for storing internal
>+	 * info, which needs alignment.
>+	 */
>+	objsize = small_align(objsize, alignof(uint64_t));
> 
> 	quota_init(&quota, UINT_MAX);
> 
>-- 
>2.21.1 (Apple Git-122.3)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20200621/7b9501e5/attachment.html>


More information about the Tarantool-patches mailing list