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 DF37E2904 for ; Tue, 16 Jan 2018 14:51:57 +0100 (CET) Received: from lfbn-lil-1-110-231.w90-45.abo.wanadoo.fr ([90.45.197.231] helo=droids-corp.org) by mail.droids-corp.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ebRei-00009U-9f; Tue, 16 Jan 2018 14:52:01 +0100 Received: by droids-corp.org (sSMTP sendmail emulation); Tue, 16 Jan 2018 14:51:55 +0100 Date: Tue, 16 Jan 2018 14:51:55 +0100 From: Olivier Matz To: Hemant Agrawal Cc: dev@dpdk.org Message-ID: <20180116135155.x5g576ax5gsy2ezv@platinum> References: <1512563473-19969-1-git-send-email-hemant.agrawal@nxp.com> <20171219102456.ghipiyb2ig43d4nk@glumotte.dev.6wind.com> <830d3e36-921b-ef7a-51a4-6d135b15e973@nxp.com> <20171219110204.uqxw4xy66o65pnjz@glumotte.dev.6wind.com> <9adf0fc2-b233-26c6-b866-236d6277a4ed@nxp.com> <42572f99-99bd-ee70-e631-b817d1d679ac@nxp.com> <20171222135929.ei35n7gs55u3jqvr@platinum> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH 1/2] mempool: indicate the usages of multi memzones X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jan 2018 13:51:58 -0000 On Fri, Dec 22, 2017 at 09:48:01PM +0530, Hemant Agrawal wrote: > On 12/22/2017 7:29 PM, Olivier MATZ wrote: > > On Wed, Dec 20, 2017 at 05:29:59PM +0530, Hemant Agrawal wrote: > > > On 12/19/2017 6:38 PM, Hemant Agrawal wrote: > > > > > > > > > That's true, I commented too fast :) > > > > > And what about using mp->nb_mem_chunks instead? Would it do the job > > > > > in your use-case? > > > > > > > > It should work. Let me check it out. > > > > > > There is a slight problem with nb_mem_chunks. > > > > > > It is getting incremented in the end of "rte_mempool_populate_phys", > > > while the elements are getting populated before it in the call of > > > mempool_add_elem. > > > > > > I can use nb_mem_chunks are '0' check. However it can break in future if > > > mempool_populate_phys changes. > > > > Sorry, I'm not sure I'm getting what you say. > > > > My question was about using mp->nb_mem_chunks instead of a new flag in the > > dppa driver. Am I missing something? > > > > mp->nb_mem_chunks gets finalized when the mempool is fully created. It's > value is transient before that i.e. it will keep on changing on the every > call to rte_mempool_populate_phys. > > However, we need this information on the very first element allocation. So, > nb_mem_chunks will not work. I see 2 other alternatives: 1/ in your driver, register a callback rte_mempool_ops_register_memory_area() that sets a private flag if (len < total_elt_sz * mp->size). 2/ Move STAILQ_INSERT_TAIL(&mp->mem_list, memhdr, next); mp->nb_mem_chunks++; before the calls to mempool_add_elem(), and in your driver check if SLIST_FIRST(&mp->mem_list)->len < total_elt_sz * mp->size If we can avoid to again create another flag, it is better.