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 1F5DC58E8 for ; Mon, 9 Feb 2015 15:08:37 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 09 Feb 2015 06:08:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,544,1418112000"; d="scan'208";a="663703434" Received: from pgsmsx103.gar.corp.intel.com ([10.221.44.82]) by fmsmga001.fm.intel.com with ESMTP; 09 Feb 2015 06:08:34 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by PGSMSX103.gar.corp.intel.com (10.221.44.82) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 9 Feb 2015 22:08:33 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.62]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.209]) with mapi id 14.03.0195.001; Mon, 9 Feb 2015 22:08:33 +0800 From: "Liang, Cunming" To: Olivier MATZ , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v4 10/17] malloc: fix the issue of SOCKET_ID_ANY Thread-Index: AQHQPoxtdhe+i5aUOUyOObMu1vyMF5zmsKwAgAGxcqA= Date: Mon, 9 Feb 2015 14:08:34 +0000 Message-ID: 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> <54D7C074.20204@6wind.com> In-Reply-To: <54D7C074.20204@6wind.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Mon, 09 Feb 2015 14:08:38 -0000 > -----Original Message----- > From: Olivier MATZ [mailto:olivier.matz@6wind.com] > Sent: Monday, February 09, 2015 4:01 AM > To: Liang, Cunming; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v4 10/17] malloc: fix the issue of SOCKET_= ID_ANY >=20 > Hi, >=20 > 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 =3D rte_socket_id(); > > + > > + if (socket_id =3D=3D (unsigned)SOCKET_ID_ANY) > > + return 0; > > + > > + return socket_id; > > } > > > > void * > > >=20 > The documentation off rte_malloc_socket() says: >=20 > @param socket > NUMA socket to allocate memory on. If SOCKET_ID_ANY is used, this > function will behave the same as rte_malloc(). >=20 > void * > rte_malloc_socket(const char *type, size_t size, unsigned align, int > socket); >=20 >=20 > Your patch changes the behavior of rte_malloc() without explaining > why, and the documentation becomes wrong. >=20 > Can you explain why you need this change? [LCM] I don't think I change the declaration of rte_malloc_socket(). If socket_arg=3DSOCKET_ID_ANY, the socket value expect to the return value = of malloc_get_numa_socket(). The malloc_get_numa_socket() supposed to return the correct TLS _socket_id. It works fine for normal cases. But as we change the default value of TLS _= socket_id to SOCKET_ID_ANY. And one lcore can run on multiple cpu, if all cpus in the cpuset are not be= longs to one NUMA node, the _socket_id would be SOCKET_ID_ANY. When user call rte_malloc_socket(SOCKET_ID_ANY), it does provide the same b= ehavior as rte_malloc(). They both will get socket_id from malloc_get_numa_socket(). The addition pa= rt is the exception path process. >=20 > Regards, > Olivier