From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 0FA408DAD for ; Wed, 13 Jan 2016 12:48:28 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 13 Jan 2016 03:48:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,288,1449561600"; d="scan'208";a="892284988" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.208.64]) by fmsmga002.fm.intel.com with SMTP; 13 Jan 2016 03:48:21 -0800 Received: by (sSMTP sendmail emulation); Wed, 13 Jan 2016 11:48:20 +0025 Date: Wed, 13 Jan 2016 11:48:20 +0000 From: Bruce Richardson To: "Hanoch Haim (hhaim)" Message-ID: <20160113114820.GB7216@bricha3-MOBL3> References: <568A7959.7030506@6wind.com> <7f5255b98dcb4f2396ada16d5eb43e5a@XCH-RTP-017.cisco.com> <568BA1A1.2070300@6wind.com> <521c3b8c6a014c24824bb1c5f17dca03@XCH-RTP-017.cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <521c3b8c6a014c24824bb1c5f17dca03@XCH-RTP-017.cisco.com> Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "dev@dpdk.org" , "Itay Marom \(imarom\)" , "Ido Barnea \(ibarnea\)" Subject: Re: [dpdk-dev] [PATCH v2] mbuf: optimize rte_mbuf_refcnt_update 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: Wed, 13 Jan 2016 11:48:29 -0000 On Tue, Jan 05, 2016 at 11:11:24AM +0000, Hanoch Haim (hhaim) wrote: > Hi Oliver, > Thank you for the fast response and it would be great to open a discussion on that. > In general our project can leverage your optimization and I think it is great (we should have thought about it) . We can use it using the workaround I described. > However, for me it seems odd that rte_pktmbuf_attach () that does not *change* anything in m_const, except of the *atomic* ref counter does not work in parallel. > The example I gave is a classic use case of rte_pktmbuf_attach (multicast ) and I don't see why it wouldn't work after your optimization. > > Do you have a pointer to the documentation that state that that you can't call the atomic ref counter from more than one thread? > Hi, actually, the issue is not that you can't work with the reference counter field from multiple threads, or that you can't use an mbuf from multiple threads, it's that if you are working with the same mbuf in multiple threads you have multiple references to the mbuf and your application must increase the reference counter appropriately. For example, if thread A is going to pass an mbuf to thread B and keep using it itself, you must increment the reference counter in thread A before enqueuing it to B. Regards, /Bruce