From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp3.mail.ru (smtp3.mail.ru [94.100.179.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 5160F469710 for ; Sat, 16 May 2020 22:09:34 +0300 (MSK) References: <2bb14550-b2f0-5f0f-1ea4-400d7cbd48bf@tarantool.org> From: Aleksandr Lyapunov Message-ID: <3f222d25-64d0-17c7-6c75-63cd1711f147@tarantool.org> Date: Sat, 16 May 2020 22:09:32 +0300 MIME-Version: 1.0 In-Reply-To: <2bb14550-b2f0-5f0f-1ea4-400d7cbd48bf@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [Tarantool-patches] [PATCH small 0/2] Aligned lsregion List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, korablev@tarantool.org, tsafin@tarantool.org, gorcunov@gmail.com On 5/16/20 2:22 AM, Vladislav Shpilevoy wrote: > >> lsregion will allocate aligned addresses as long as you request only aligned sizes, >> up to sizeof(uintptr_t) (see lslab_sizeof()). >> This property is not documented (maybe it should be!). It is also similar to mempool >> property, see mempool_create description. > Yeah, here are 3 problems: > - lsregion is used not only for tuples, but for bps tree extents too. We can't > rely on their alignment being the same. Sanitizer revealed, that both extents > and tuples are not aligned; Since you decided to implement _aligned_alloc anyway, it's not very important, but I want to find the truth. It could help us one day. Extents' sizes are also (very) aligned, all you need is to align tuple sizes, as I proposed. Try it and you will see: if you align sizes (up to 8) - you'll get aligned addresses. > - sanitizer revealed, that mempool_alloc returns unaligned addresses too. I am > going to look into that after lsregion; I checked the code and I confirm that if mempool item size is aligned, the addresses will be also aligned. Could you suggest me how to get those sanitizer results? I also see that small_alloc aligns all allocations with 8 bytes. > - slab first position can be aligned not enough. So we can't assume anything > about first address in a slab. And therefore about all the other addresses > too. Yes, that position is aligned with 8 bytes now. Are there any cases when we need bigger align factor? > >> I like one-line change more. >> >> If you still want _reserve and _aligned_alloc method for further purposes, please >> read my by-commit comments. > I want lsregion be consistent with other allocators, and provide basic > API for aligned allocations. Like region does. Ok, that's a great idea, doesn't it earn a special ticket on github?