DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mem: get memzone from any CPU socket when hugepages are disabled
@ 2013-07-26 14:35 Adrien Mazarguil
  2013-07-26 14:56 ` Damien Millescamps
  0 siblings, 1 reply; 3+ messages in thread
From: Adrien Mazarguil @ 2013-07-26 14:35 UTC (permalink / raw)
  To: dev

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>
---
 lib/librte_eal/common/eal_common_memzone.c | 1 +
 lib/librte_eal/linuxapp/eal/eal_memory.c   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
index 5532f0d..9872070 100644
--- a/lib/librte_eal/common/eal_common_memzone.c
+++ b/lib/librte_eal/common/eal_common_memzone.c
@@ -150,6 +150,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, uint64_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 ce0c2d8..d50726d 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -786,7 +786,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;
 	}
 
-- 
1.7.12

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-26 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-26 14:35 [dpdk-dev] [PATCH] mem: get memzone from any CPU socket when hugepages are disabled Adrien Mazarguil
2013-07-26 14:56 ` Damien Millescamps
2013-07-26 15:09   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).