I do not like this change. It will work, but it's not optimal.+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);
If we really need aligned alloc, I'm sure we should implement it
more carefully.
I think it should start with something like:
static inline size_t
-lslab_unused(const struct lslab *slab)
+lslab_unused(const struct lslab *slab, size_t align)
{
- assert(slab->slab_size >= slab->slab_used);
- return slab->slab_size - slab->slab_used;
+ assert(slab->slab_size >=
small_align(slab->slab_used, align));
+ return slab->slab_size -
small_align(slab->slab_used, align);
}