Skip to content
Snippets Groups Projects
Commit ccfef5fd authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Vladimir Davydov
Browse files

memtx: ignore slab_alloc_granularity < machine word size

box.cfg.slab_alloc_granularity sets the min alignment used for struct
memtx_tuple. By default, it's set to the machine word size (8 bytes
typically), but it can be set to 4 bytes to reduce memory usage.

The problem is that we add memtx tuples to a garbage collection list
using the intrusive list pattern (basically, store a pointer to the next
entry in the first 8 bytes of the `memtx_tuple` struct). If
`box.cfg.slab_alloc_factor` is set to 4, the pointer will be unaligned
while the compiler will generate the machine code assuming it is
naturally aligned. For some architectures (x86), this works fine, but
for others (ARM), this may result in a runtime failure.

To fix this issue, we need to instruct the compiler that the list
pointer stored in `memtx_tuple` may be unaligned.

For now, let's silently ignore granularity < the machine word size,
because we're planning to switch from lifo to stailq for memtx garbage
collection lists, which would result in explicit compiler warnings.

See #7422
Needed for #7185

NO_DOC=invisible to the user
NO_CHANGELOG=invisible to the user
NO_TEST=will be added later when the bug is fixed
parent 0aab49f0
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment