From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: Aleksandr Lyapunov <alyapunov@tarantool.org>, tarantool-patches@dev.tarantool.org, korablev@tarantool.org, tsafin@tarantool.org, gorcunov@gmail.com Subject: Re: [Tarantool-patches] [PATCH small 0/2] Aligned lsregion Date: Sat, 16 May 2020 01:22:50 +0200 [thread overview] Message-ID: <2bb14550-b2f0-5f0f-1ea4-400d7cbd48bf@tarantool.org> (raw) In-Reply-To: <a3c208e0-69bd-74fb-15c0-16156b63f60e@tarantool.org> Hi! Thanks for the review! On 15/05/2020 14:26, Aleksandr Lyapunov wrote: > Thanks for the patch! see comments below. > > On 5/15/20 2:31 AM, Vladislav Shpilevoy wrote: >> The patchset introduces a new function - lsregion_aligned_alloc(). > > Actually you don't need the patch for fixing #4609. > If you want to align vy_mem tuple by 4 bytes (due to uint32_t bsize), all you need is: > > diff --git a/src/box/vy_stmt.c b/src/box/vy_stmt.c > index adc3ba4..2de4a28 100644 > --- a/src/box/vy_stmt.c > +++ b/src/box/vy_stmt.c > @@ -228,7 +228,7 @@ vy_stmt_dup_lsregion(struct tuple *stmt, struct lsregion *lsregion, > if (type == IPROTO_UPSERT) > alloc_size++; > > - mem_stmt = lsregion_alloc(lsregion, alloc_size, alloc_id); > + mem_stmt = lsregion_alloc(lsregion, small_align(alloc_size, 4), alloc_id); > if (mem_stmt == NULL) { > diag_set(OutOfMemory, size, "lsregion_alloc", "mem_stmt"); > return NULL; > > 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; - sanitizer revealed, that mempool_alloc returns unaligned addresses too. I am going to look into that after lsregion; - 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. > 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.
next prev parent reply other threads:[~2020-05-15 23:22 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-14 23:31 Vladislav Shpilevoy 2020-05-14 23:31 ` [Tarantool-patches] [PATCH small 1/2] lsregion: introduce lsregion_reserve() Vladislav Shpilevoy 2020-05-15 12:35 ` Aleksandr Lyapunov 2020-05-14 23:31 ` [Tarantool-patches] [PATCH small 2/2] lsregion: provide aligned version of alloc Vladislav Shpilevoy 2020-05-15 13:03 ` Aleksandr Lyapunov 2020-05-15 23:24 ` Vladislav Shpilevoy 2020-05-15 12:26 ` [Tarantool-patches] [PATCH small 0/2] Aligned lsregion Aleksandr Lyapunov 2020-05-15 23:22 ` Vladislav Shpilevoy [this message] 2020-05-16 19:09 ` Aleksandr Lyapunov 2020-05-17 13:56 ` Vladislav Shpilevoy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=2bb14550-b2f0-5f0f-1ea4-400d7cbd48bf@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=alyapunov@tarantool.org \ --cc=gorcunov@gmail.com \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=tsafin@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH small 0/2] Aligned lsregion' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox