[dpdk-dev] [PATCH v6 12/19] malloc: fix the issue of SOCKET_ID_ANY
Neil Horman
nhorman at tuxdriver.com
Fri Feb 13 18:57:09 CET 2015
On Fri, Feb 13, 2015 at 09:38:14AM +0800, Cunming Liang wrote:
> Add check for rte_socket_id(), avoid get unexpected return like (-1).
>
> Signed-off-by: Cunming Liang <cunming.liang at intel.com>
> ---
> 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;
Why is -1 unexpected? Isn't it reasonable to assume that some memory is
equidistant from all cpu numa nodes?
Neil
> }
>
> void *
> --
> 1.8.1.4
>
>
More information about the dev
mailing list