On Tue, May 05, 2020 at 02:24:07PM +0000, Anatoly Burakov wrote:
> Currently, in order to perform a memzone lookup and create/free
> the memzone, the user has to call two API's, creating a race
> condition. This is particularly destructive for memzone_free call
> because the reference provided to memzone_free at the time of call
> may be stale or refer to a different memzone altogether.
> 
> Fix this race condition by adding an API to perform lookup and
> create/free memzone in one go.
> 
> Signed-off-by: Anatoly Burakov <anatoly.bura...@intel.com>
> ---
>  lib/librte_eal/common/eal_common_memzone.c | 125 ++++++++---
>  lib/librte_eal/include/rte_memzone.h       | 235 +++++++++++++++++++++
>  lib/librte_eal/rte_eal_version.map         |   4 +
>  3 files changed, 340 insertions(+), 24 deletions(-)
> 
While I agree that there is a race, is this really a problem in the real
world? Do we really need to expand the number of APIs for allocating memory
further?

If we really do need the ability to do lookup and create in one, rather
than adding new APIs can we not just add another flag to the existing
rte_memzone_reserve call?

Reply via email to