[dpdk-dev] [RFC 4/4] mempool: prevent objects from being across pages
Burakov, Anatoly
anatoly.burakov at intel.com
Fri Jul 19 16:11:40 CEST 2019
On 19-Jul-19 2:38 PM, Olivier Matz wrote:
> When using iova contiguous memory and objets smaller than page size,
> ensure that objects are not located across several pages.
>
> Signed-off-by: Vamsi Krishna Attunuru <vattunuru at marvell.com>
> Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
> ---
<snip>
> total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size;
>
> - for (off = 0, i = 0; off + total_elt_sz <= len && i < max_objs; i++) {
> + for (off = 0, i = 0; i < max_objs; i++) {
> + /* align offset to next page start if required */
> + if (mempool_check_obj_bounds((char *)vaddr + off,
> + pg_sz, total_elt_sz) < 0) {
> + off += RTE_PTR_ALIGN_CEIL((char *)vaddr + off, pg_sz) -
> + ((char *)vaddr + off);
Same here, PTR_ALIGN plus PTR_SUB. It's perhaps not as cool as a
one-liner, but this is not a hot path :)
--
Thanks,
Anatoly
More information about the dev
mailing list