<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 5/15/20 2:31 AM, Vladislav Shpilevoy
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:90f1c60ad69d7e577467ad0d1664bbfee3816df7.1589498880.git.v.shpilevoy@tarantool.org">
<pre class="moz-quote-pre" wrap="">+static inline void *
+lsregion_aligned_alloc(struct lsregion *lsregion, size_t size, size_t alignment,
+ int64_t id)
+{
+ void *unaligned = lsregion_reserve(lsregion, size + alignment - 1);</pre>
</blockquote>
I do not like this change. It will work, but it's not optimal.<br>
We don't need to reserve more than size if lslab_pos(slab) is
already aligned.<br>
It could lead to new slab allocation in cases we actually have
enough aligned space in current.<br>
<p>If we really need aligned alloc, I'm sure we should implement it
more carefully.<br>
I think it should start with something like:<br>
<font size="-1"> static inline size_t<br>
-lslab_unused(const struct lslab *slab)<br>
+lslab_unused(const struct lslab *slab, size_t align)<br>
{<br>
- assert(slab->slab_size >= slab->slab_used);<br>
- return slab->slab_size - slab->slab_used;<br>
+ assert(slab->slab_size >=
small_align(slab->slab_used, align));<br>
+ return slab->slab_size -
small_align(slab->slab_used, align);<br>
}<br>
</font><br>
</p>
Note also we should remove small_align call from lslab_sizeof
method.<br>
</body>
</html>