hash: allocate memory on right numa socket
authorIntel <intel.com>
Wed, 19 Dec 2012 23:00:00 +0000 (00:00 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 25 Jul 2013 13:23:27 +0000 (15:23 +0200)
Signed-off-by: Intel
lib/librte_hash/rte_fbk_hash.c
lib/librte_hash/rte_hash.c

index fa397f5..8128dfb 100644 (file)
@@ -138,7 +138,8 @@ rte_fbk_hash_create(const struct rte_fbk_hash_params *params)
                return NULL;
 
        /* Allocate memory for table. */
-       ht = (struct rte_fbk_hash_table *)rte_malloc(hash_name, mem_size, 0);
+       ht = (struct rte_fbk_hash_table *)rte_malloc_socket(hash_name, mem_size,
+                       0, params->socket_id);
        if (ht == NULL)
                return NULL;
        memset(ht, 0, mem_size);
index 13958a3..e1a909a 100644 (file)
@@ -213,8 +213,8 @@ rte_hash_create(const struct rte_hash_parameters *params)
        if (h != NULL)
                return NULL;
 
-       h = (struct rte_hash *)rte_zmalloc(hash_name, mem_size,
-                                          CACHE_LINE_SIZE);
+       h = (struct rte_hash *)rte_zmalloc_socket(hash_name, mem_size,
+                                          CACHE_LINE_SIZE, params->socket_id);
        if (h == NULL) {
                RTE_LOG(ERR, HASH, "memory allocation failed\n");
                return NULL;