[Tarantool-patches] FW: [PATCH] memtx: change small allocator behavior

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Mon Dec 28 15:10:45 MSK 2020


Hi! Thanks for the answers!

Now much better, I understood almost everything. The only
issue seems to be with your editor now. You have extra
empty lines after each non-empty line in your emails. Do
you use a web version of mail client?

It should be all fixed if you switch to a plain-text client.
It won't ruin the cites and won't add any extra lines.

>> +                alloc_factor = 1.001;
> 
>  
> 
> 2. I don't see the factor being rounded up in the original code.
> 
> Why did you add it? And why 1.0 is bad?
> 
>  
> Answer:
>  
> Here is a code which rounded up alloc factor in master branch.
>     /*
>      * Correct the user-supplied alloc_factor to ensure that
>      * it actually produces growing object sizes.
>      */
>     if (alloc->step_pool_objsize_max * alloc_factor <
>         alloc->step_pool_objsize_max + STEP_SIZE) {
>         alloc_factor =
>             (alloc->step_pool_objsize_max + STEP_SIZE + 0.5)/
>             alloc->step_pool_objsize_max;
>     }
>     I use gdb to show it:
>     tarantool> box.cfg{slab_alloc_factor = 1.01}
>     2020-12-24 19:22:33.416 [22602] main/103/interactive C> Tarantool 2.7.0-148-gd5a5754a3
>     2020-12-24 19:22:33.416 [22602] main/103/interactive C> log level 5
>     2020-12-24 19:22:33.416 [22602] main/103/interactive I> mapping 268435456 bytes for memtx tuple arena...
>     Breakpoint 1, small_alloc_create (alloc=0x555555cfe788, cache=0x555555cfe530, objsize_min=272,
>                           alloc_factor=1.00999999) at /home/evgeny/MASTER/tarantool/src/lib/small/small/small.c:135
>     135                     alloc_factor =
>     (gdb) n
>     139             alloc->factor = alloc_factor;
>     (gdb) p alloc_factor
>     $1 = 1.032197
>     (gdb)
>     As you can see if you pass slab_alloc_factor < 1.03 it's changed to 1.03. I try 0.01 factor and get the same value.
>     It's code from master branch, now user can pass >= 1.001 factor. We can't use 1.0, because we need increment to pool size.

Ok, now I see, thanks.


More information about the Tarantool-patches mailing list