the second parameter of function rte_mempool_create mustn't be 2^q - 1

Bug #1786767 reported by Yi-y-yang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R5.0
In Progress
Undecided
Yi-y-yang
Trunk
Fix Committed
High
Yi-y-yang
OpenContrail
New
Undecided
Unassigned

Bug Description

in DPDK header file lib/librte_mempool/rte_mempool.h, function rte_mempool_create document says:

The optimum size (in terms of memory usage) for a mempool is when n is a power of two minus one: n = (2^q - 1).

But actually it isn't true, in the rest of this function, it says again:

It is advised to choose cache_size to have "n modulo cache_size == 0", if this is not the case, some elements will always stay in the pool and will never be used.

Obviously, these statement is self-contradictory. If n is (2^q -1), it is impossible to have "n modulo cache_size == 0".

Per our experiment, "n modulo cache_size == 0" is better than "n = (2^q -1)". In all the rte_mempool_create calls in DPDK source code, we don't find any case which used 2^q - 1 for the second parameter. So we're inclined to use "n modulo cache_size == 0".

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/45523
Submitter: Yi Yang (<email address hidden>)

Jeba Paulaiyan (jebap)
tags: added: dpdk
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R5.0

Review in progress for https://review.opencontrail.org/46050
Submitter: Jeya ganesh babu (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/45523
Committed: http://github.com/Juniper/contrail-vrouter/commit/c2c9835319119b5fce2d13eba6c90e97643d7c81
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit c2c9835319119b5fce2d13eba6c90e97643d7c81
Author: Yi Yang <email address hidden>
Date: Mon Aug 13 20:23:05 2018 +0800

Fix the number of elements in mempool

the second parameter of function rte_mempool_create should
be "n modulo cache_size == 0" but not (2^q - 1).

The issue is some elements will always stay in the pool and
will never be used if "n modulo cache_size != 0".

Change-Id: I34555faffb09efb744dc34a384eaff152dc675b8
Closes-Bug: #1786767
Signed-off-by: Yi Yang <email address hidden>

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers