From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: Re: [PATCH] mempool: allow for user-owned mempool caches Date: Fri, 25 Mar 2016 11:55:46 +0100 Message-ID: <56F51932.3060500@6wind.com> References: <1457621082-22151-1-git-send-email-l@nofutznetworks.com> <56EFE781.4090809@6wind.com> <1FFBBED4-00F5-4703-BDEC-961EB800C21B@intel.com> <1FD9B82B8BF2CF418D9A1000154491D97EC94508@ORSMSX102.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" To: "Venkatesan, Venky" , Lazaros Koromilas , "Wiles, Keith" Return-path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 5754F4CE4 for ; Fri, 25 Mar 2016 11:55:49 +0100 (CET) Received: by mail-wm0-f47.google.com with SMTP id l68so19050769wml.1 for ; Fri, 25 Mar 2016 03:55:49 -0700 (PDT) In-Reply-To: <1FD9B82B8BF2CF418D9A1000154491D97EC94508@ORSMSX102.amr.corp.intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Venky, >> The main benefit of having an external cache is to allow mempool users >> (threads) to maintain a local cache even though they don't have a valid >> lcore_id (non-EAL threads). The fact that cache access is done by indexing >> with the lcore_id is what makes it difficult... > > Hi Lazaros, > > Alternative suggestion: This could actually be very simply done via creating an EAL API to register and return an lcore_id for a thread wanting to use DPDK services. That way, you could simply create your pthread, call the eal_register_thread() function that assigns an lcore_id to the caller (and internally sets up the per_lcore variable. > > The advantage of doing it this way is that you could extend it to other things other than the mempool that may need an lcore_id setup. >>From my opinion, externalize the cache structure as Lazaros suggests would make things simpler, especially in case of dynamic threads allocation/destruction. If a lcore_id regristration API is added in EAL, we still need a max lcore value when the mempool is created so the cache can be allocated. Moreover, the API would not be as simple, especially if it needs to support secondary processes. Regards, Olivier