Re: [PATCH v3] mempool: simplify get objects

Thomas Monjalon
2026-03-17T08:51:38Z

17/02/2026 07:53, Andrew Rybchenko:
> On 2/16/26 12:27 PM, Morten Brørup wrote:
> > Removed explicit test for build time constant request size,
> > and added comment that the compiler loop unrolls when request size is
> > build time constant, to improve source code readability.
> >
> > Moved setting cache->len up before the copy loop; not only for code
> > similarity (cache->len is now set before each copy loop), but also as an
> > optimization:
> > The function's pointer parameters are not marked restrict, so writing to
> > obj_table in the copy loop might formally modify cache->size. And thus,
> > setting cache->len = cache->size after the copy loop requires loading
> > cache->size again after copying the objects.
> > Moving this line up before the copy loop avoids that extra load of
> > cache->size when setting cache->len.
> >
> > Similarly, moved statistics update up before the copy loops.
> >
> > Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

Applied, thanks.