From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (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 BACAF469710 for ; Tue, 19 May 2020 19:16:31 +0300 (MSK) References: <194d73cbb844795fbe2a9a6599bb684f4e6a0cf2.1589584903.git.v.shpilevoy@tarantool.org> From: Aleksandr Lyapunov Message-ID: <37627072-9069-6c17-8546-46793dd4d2c1@tarantool.org> Date: Tue, 19 May 2020 19:16:30 +0300 MIME-Version: 1.0 In-Reply-To: <194d73cbb844795fbe2a9a6599bb684f4e6a0cf2.1589584903.git.v.shpilevoy@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [Tarantool-patches] [PATCH v2 small 1/1] lsregion: introduce aligned alloc List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, tsafin@tarantool.org, gorcunov@gmail.com Thank for the changes! lgtm. On 5/16/20 2:21 AM, Vladislav Shpilevoy wrote: > lsregion_alloc() can return a not aligned address, even odd. This > is not good when the allocation is going to be used for a type, > which requires alignment, such as a number, or a struct having > numbers in it. > > Unaligned access to objects saved into the returned memory is > either slower than aligned access, or can even lead to a crash on > certain architectures. Also it makes 'alignment' clang sanitizer > crazy. > > The patch provides a function to make aligned allocations on > lsregion. > > Part of https://github.com/tarantool/tarantool/issues/4609 > --- > Branch: http://github.com/tarantool/small/tree/gerold103/aligned-lsregion > Issue: https://github.com/tarantool/tarantool/issues/4609 > > Changes in v2: > - Made lsregion do not reserve extra bytes, when aligned > allocation is requested, and the first available address is > already aligned.