From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id 713DB28FD for ; Fri, 15 Apr 2016 09:42:38 +0200 (CEST) Received: from was59-1-82-226-113-214.fbx.proxad.net ([82.226.113.214] helo=[192.168.0.10]) by mail.droids-corp.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1aqyQW-00050U-Di; Fri, 15 Apr 2016 09:44:28 +0200 To: "Wiles, Keith" , "dev@dpdk.org" References: <1457540381-20274-1-git-send-email-olivier.matz@6wind.com> <1460629199-32489-1-git-send-email-olivier.matz@6wind.com> <1460629199-32489-27-git-send-email-olivier.matz@6wind.com> <2176C989-77F0-4C88-B40D-BD97D58B9A20@intel.com> Cc: "Richardson, Bruce" , "stephen@networkplumber.org" From: Olivier Matz Message-ID: <57109B68.5070807@6wind.com> Date: Fri, 15 Apr 2016 09:42:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0 MIME-Version: 1.0 In-Reply-To: <2176C989-77F0-4C88-B40D-BD97D58B9A20@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 26/36] mempool: introduce a function to create an empty mempool X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Apr 2016 07:42:38 -0000 On 04/14/2016 05:57 PM, Wiles, Keith wrote: >> Introduce a new function rte_mempool_create_empty() >> that allocates a mempool that is not populated. >> >> The functions rte_mempool_create() and rte_mempool_xmem_create() >> now make use of it, making their code much easier to read. >> Currently, they are the only users of rte_mempool_create_empty() >> but the function will be made public in next commits. >> >> Signed-off-by: Olivier Matz >> +/* create an empty mempool */ >> +static struct rte_mempool * >> +rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size, >> + unsigned cache_size, unsigned private_data_size, >> + int socket_id, unsigned flags) >> { > > When two processes need to use the same mempool, do we have a race condition with one doing a rte_mempool_create_empty() and the other process tries to use it when it finds that mempool before being fully initialized by the first process? > I'm not an expert of the dpdk multiprocess model. But I would say that there are a lot of possible race conditions like this (ex: a port is created but not started), and I assume that applications doing multiprocess have their synchronization. If we really want a solution in mempool, we could: - remove the TAILQ_INSERT_TAIL() from rte_mempool_create() - create a new function rte_mempool_share() that adds the mempool in the tailq for multiprocess. This function would be called at the end of rte_mempool_create(), or by the user if using rte_mempool_create_empty(). I may be mistaking but I don't feel it's really required. Any comment from a multiprocess expert is welcome though. Regards, Olivier