physmem: fix physmem allocation on kernels without NUMA support
Change-Id: I056598a1818a39c2da73e252600c14585e5aae83
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vlib/linux/physmem.c b/src/vlib/linux/physmem.c
index 161dbf5..72b00e2 100644
--- a/src/vlib/linux/physmem.c
+++ b/src/vlib/linux/physmem.c
@@ -223,8 +223,8 @@
{
void *ptr = pr->mem + (i << pr->log2_page_size);
int node;
- move_pages (0, 1, &ptr, 0, &node, 0);
- if (numa_node != node)
+ if ((move_pages (0, 1, &ptr, 0, &node, 0) == 0) &&
+ (numa_node != node))
{
clib_warning ("physmem page for region \'%s\' allocated on the"
" wrong numa node (requested %u actual %u)",
diff --git a/src/vppinfra/linux/mem.c b/src/vppinfra/linux/mem.c
index 2d8f593..e0e22b0 100644
--- a/src/vppinfra/linux/mem.c
+++ b/src/vppinfra/linux/mem.c
@@ -71,12 +71,12 @@
if (a->flags & (CLIB_MEM_VM_F_NUMA_PREFER | CLIB_MEM_VM_F_NUMA_FORCE))
{
int rv;
- rv =
- get_mempolicy (&old_mpol, old_mask, sizeof (old_mask) * 8 + 1, 0, 0);
+ rv = get_mempolicy (&old_mpol, old_mask, sizeof (old_mask) * 8 + 1,
+ 0, 0);
if (rv == -1)
{
- if ((a->flags & CLIB_MEM_VM_F_NUMA_FORCE) != 0)
+ if (a->numa_node != 0 && (a->flags & CLIB_MEM_VM_F_NUMA_FORCE) != 0)
{
err = clib_error_return_unix (0, "get_mempolicy");
goto error;
@@ -193,7 +193,7 @@
goto error;
}
- /* re-apply ole numa memory policy */
+ /* re-apply old numa memory policy */
if (old_mpol != -1 &&
set_mempolicy (old_mpol, old_mask, sizeof (old_mask) * 8 + 1) == -1)
{