summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Mazarguil <adrien.mazarguil@6wind.com>2013-02-21 17:39:23 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2013-09-17 14:16:11 +0200
commit0fd24c236d10fab0ffd71f3b8dbccc7a07fb3794 (patch)
tree7244a4c2166bdc523eb80b3f60add692c0ea2444
parent2f181fc3cef7e824f1f8aeb2438c954a86e8c191 (diff)
downloaddpdk-0fd24c236d10fab0ffd71f3b8dbccc7a07fb3794.zip
dpdk-0fd24c236d10fab0ffd71f3b8dbccc7a07fb3794.tar.gz
dpdk-0fd24c236d10fab0ffd71f3b8dbccc7a07fb3794.tar.xz
mem: get memzone from any CPU socket when hugepages are disabled
When huge pages are disabled, memory is allocated for a single, undefined CPU socket using malloc(), causing rte_memzone_reserve_aligned() to fail most of the time. This patch causes that memory to use SOCKET_ID_ANY instead of 0, and allow it to be used in place of any socket ID specified by user. Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Acked-by: Damien Millescamps <damien.millescamps@6wind.com>
-rw-r--r--lib/librte_eal/common/eal_common_memzone.c1
-rw-r--r--lib/librte_eal/linuxapp/eal/eal_memory.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
index a6eeb5a..00d2c47 100644
--- a/lib/librte_eal/common/eal_common_memzone.c
+++ b/lib/librte_eal/common/eal_common_memzone.c
@@ -155,6 +155,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
/* bad socket ID */
if (socket_id != SOCKET_ID_ANY &&
+ free_memseg[i].socket_id != SOCKET_ID_ANY &&
socket_id != free_memseg[i].socket_id)
continue;
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index b70eb76..8fb53b3 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -731,7 +731,7 @@ rte_eal_hugepage_init(void)
mcfg->memseg[0].phys_addr = (phys_addr_t)(uintptr_t)addr;
mcfg->memseg[0].addr = addr;
mcfg->memseg[0].len = internal_config.memory;
- mcfg->memseg[0].socket_id = 0;
+ mcfg->memseg[0].socket_id = SOCKET_ID_ANY;
return 0;
}