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 599885A45 for ; Sun, 8 Feb 2015 21:01:05 +0100 (CET) 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:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YKY61-0005Po-MS; Sun, 08 Feb 2015 21:04:52 +0100 Message-ID: <54D7C074.20204@6wind.com> Date: Sun, 08 Feb 2015 21:00:52 +0100 From: Olivier MATZ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0 MIME-Version: 1.0 To: Cunming Liang , dev@dpdk.org References: <1422491072-5114-1-git-send-email-cunming.liang@intel.com> <1422842559-13617-1-git-send-email-cunming.liang@intel.com> <1422842559-13617-11-git-send-email-cunming.liang@intel.com> In-Reply-To: <1422842559-13617-11-git-send-email-cunming.liang@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v4 10/17] malloc: fix the issue of SOCKET_ID_ANY 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: Sun, 08 Feb 2015 20:01:05 -0000 Hi, On 02/02/2015 03:02 AM, Cunming Liang wrote: > Add check for rte_socket_id(), avoid get unexpected return like (-1). > > Signed-off-by: Cunming Liang > --- > lib/librte_malloc/malloc_heap.h | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_malloc/malloc_heap.h b/lib/librte_malloc/malloc_heap.h > index b4aec45..a47136d 100644 > --- a/lib/librte_malloc/malloc_heap.h > +++ b/lib/librte_malloc/malloc_heap.h > @@ -44,7 +44,12 @@ extern "C" { > static inline unsigned > malloc_get_numa_socket(void) > { > - return rte_socket_id(); > + unsigned socket_id = rte_socket_id(); > + > + if (socket_id == (unsigned)SOCKET_ID_ANY) > + return 0; > + > + return socket_id; > } > > void * > The documentation off rte_malloc_socket() says: @param socket NUMA socket to allocate memory on. If SOCKET_ID_ANY is used, this function will behave the same as rte_malloc(). void * rte_malloc_socket(const char *type, size_t size, unsigned align, int socket); Your patch changes the behavior of rte_malloc() without explaining why, and the documentation becomes wrong. Can you explain why you need this change? Regards, Olivier