Tarantool development patches archive
 help / color / mirror / Atom feed
From: Aleksandr Lyapunov <alyapunov@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@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: Fri, 15 May 2020 15:26:15 +0300	[thread overview]
Message-ID: <a3c208e0-69bd-74fb-15c0-16156b63f60e@tarantool.org> (raw)
In-Reply-To: <cover.1589498880.git.v.shpilevoy@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]

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.

I like one-line change more.

If you still want _reserve and _aligned_alloc method for further 
purposes, please
read my by-commit comments.


[-- Attachment #2: Type: text/html, Size: 2078 bytes --]

  parent reply	other threads:[~2020-05-15 12:26 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 ` Aleksandr Lyapunov [this message]
2020-05-15 23:22   ` [Tarantool-patches] [PATCH small 0/2] Aligned lsregion Vladislav Shpilevoy
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=a3c208e0-69bd-74fb-15c0-16156b63f60e@tarantool.org \
    --to=alyapunov@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=tsafin@tarantool.org \
    --cc=v.shpilevoy@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