Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 07/10] vinyl: align statements and bps tree extents
Date: Mon, 8 Jun 2020 17:02:26 +0300	[thread overview]
Message-ID: <20200608140226.GH134822@grain> (raw)
In-Reply-To: <a90a30efe7c5786882953f419c1b1c7483f1d40a.1590093222.git.v.shpilevoy@tarantool.org>

On Thu, May 21, 2020 at 10:37:30PM +0200, Vladislav Shpilevoy wrote:
> Vinyl tuples (vy_stmt) in 0 level of LSM tree are stored in
> lsregion. They were allocated using lsregion_alloc(), which does
> not align its results, and is good only for byte arrays.
> 
> As a result, vy_stmt object addresses in 0 LSM level were not
> aligned. Unaligned memory access is slower, and may even crash on
> some platforms.
> 
> Besides, even aligned allocations couldn't help upserts in 0 level
> of the LSM tree, because upsert vy_stmt objects had 1 byte prefix
> to count merged upserts stored in this statement. This 1 byte
> prefix ruined all the alignment. Now the upsert counter is also
> aligned, the same as vy_stmt. Note, it does not consume
> significantly more memory, since it used only for vinyl and only
> for upserts, stored in 0 level of the LSM tree.
> 
> The same about BPS tree extents. LSM 0 level is a BPS tree, whose
> blocks are allocated on lsregion. The extents are used as pointer
> arrays inside the tree, so they need alignof(void *) alignment.
> 
> The mentioned unaligned accesses were revealed by clang undefined
> behaviour sanitizer, and are fixed by this patch.
> 
> Part of #4609
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>

  reply	other threads:[~2020-06-08 14:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21 20:37 [Tarantool-patches] [PATCH 00/10] Sanitize unaligned access Vladislav Shpilevoy
2020-05-21 20:37 ` [Tarantool-patches] [PATCH 01/10] small: sanitized rlist and new region API Vladislav Shpilevoy
2020-06-08 12:17   ` Cyrill Gorcunov
2020-05-21 20:37 ` [Tarantool-patches] [PATCH 10/10] xrow: use unaligned store operation in xrow_to_iovec() Vladislav Shpilevoy
2020-06-08 12:26   ` Cyrill Gorcunov
2020-05-21 20:37 ` [Tarantool-patches] [PATCH 02/10] cmake: ignore warnings on alignof() and offsetof() Vladislav Shpilevoy
2020-06-08 12:52   ` Cyrill Gorcunov
2020-05-21 20:37 ` [Tarantool-patches] [PATCH 03/10] cmake: add option ENABLE_UB_SANITIZER Vladislav Shpilevoy
2020-06-08 12:53   ` Cyrill Gorcunov
2020-05-21 20:37 ` [Tarantool-patches] [PATCH 04/10] crc32: disable align sanitizer Vladislav Shpilevoy
2020-06-08 13:58   ` Cyrill Gorcunov
2020-05-21 20:37 ` [Tarantool-patches] [PATCH 05/10] sql: make BtCursor's memory aligned Vladislav Shpilevoy
2020-06-08 13:58   ` Cyrill Gorcunov
2020-05-21 20:37 ` [Tarantool-patches] [PATCH 06/10] region: use aligned allocations where necessary Vladislav Shpilevoy
2020-06-08 14:00   ` Cyrill Gorcunov
2020-05-21 20:37 ` [Tarantool-patches] [PATCH 07/10] vinyl: align statements and bps tree extents Vladislav Shpilevoy
2020-06-08 14:02   ` Cyrill Gorcunov [this message]
2020-05-21 20:37 ` [Tarantool-patches] [PATCH 08/10] tuple: use unaligned store-load for field map Vladislav Shpilevoy
2020-06-08 14:04   ` Cyrill Gorcunov
2020-05-21 20:37 ` [Tarantool-patches] [PATCH 09/10] port: make port_c_entry not PACKED Vladislav Shpilevoy
2020-06-08 14:04   ` Cyrill Gorcunov
2020-05-21 22:25 ` [Tarantool-patches] [PATCH 00/10] Sanitize unaligned access Sergey Bronnikov
2020-05-27 23:33   ` 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=20200608140226.GH134822@grain \
    --to=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 07/10] vinyl: align statements and bps tree extents' \
    /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