From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [RFC] mem: add atomic lookup-and-reserve/free memzone API
Date: Wed, 6 May 2020 10:35:10 +0100 [thread overview]
Message-ID: <0ca5b4e6-7a8b-1044-02df-9e5b0f3600b7@intel.com> (raw)
In-Reply-To: <20200505150131.GA1437@bricha3-MOBL.ger.corp.intel.com>
On 05-May-20 4:01 PM, Bruce Richardson wrote:
> 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.burakov@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?
>
I'm not sure how much of a problem it is, hence why this is an RFC
rather than a full blown patch :) as in, "i've identified a race, do we
care?" kind of proposition.
> 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?
>
That's a good idea for memzone_reserve(), but it wouldn't work for
memzone_free().
--
Thanks,
Anatoly
prev parent reply other threads:[~2020-05-06 9:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 14:24 Anatoly Burakov
2020-05-05 15:01 ` Bruce Richardson
2020-05-06 9:35 ` Burakov, Anatoly [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0ca5b4e6-7a8b-1044-02df-9e5b0f3600b7@intel.com \
--to=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).