[RFC PATCH v3 1/2] mempool: simplify get objects
Morten Brørup
mb at smartsharesystems.com
Fri Mar 13 16:36:02 CET 2026
> From: Andrew Rybchenko [mailto:andrew.rybchenko at oktetlabs.ru]
> Sent: Tuesday, 17 February 2026 07.19
>
> Hi Morten,
>
> On 2/16/26 6:23 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 at smartsharesystems.com>
>
> LGTM, the result looks simpler, easier to read and understand.
> If there is no measurable performance degradation after the patch
>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
>
There's a real patch [1] for this RFC patch 1/2.
Marking this RFC patch 1/2 as Superseded.
[1]: https://patchwork.dpdk.org/project/dpdk/patch/20260216092750.94137-1-mb@smartsharesystems.com/
More information about the dev
mailing list