mem: get memzone from any CPU socket when hugepages are disabled
authorAdrien Mazarguil <adrien.mazarguil@6wind.com>
Thu, 21 Feb 2013 16:39:23 +0000 (17:39 +0100)
committerDavid Marchand <david.marchand@6wind.com>
Wed, 26 Feb 2014 10:07:27 +0000 (11:07 +0100)
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>
lib/librte_eal/common/eal_common_memzone.c
lib/librte_eal/linuxapp/eal/eal_memory.c

index 790f2fa..2476f3c 100644 (file)
@@ -199,6 +199,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;
 
index b980dba..98477f9 100644 (file)
@@ -995,7 +995,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;
        }