diff options
author | Damjan Marion <damarion@cisco.com> | 2017-09-08 19:21:00 +0200 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2017-09-08 20:10:36 +0000 |
commit | 816122e303efb5012f6897bd53ff8fe28cd8fa1c (patch) | |
tree | 0b5e9be9df5a43a27c58a24d021fc584e8c0e99a | |
parent | 516bcfe904415482ac0bd356e078ca15f31897d1 (diff) |
physmem: make fake allocation non-fatal if we cannot pick numa node
Change-Id: I563c043ed82e3ef199fc3d47931108f31cc01728
Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r-- | src/vlib/linux/physmem.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/vlib/linux/physmem.c b/src/vlib/linux/physmem.c index 6731295caec..fddff2ea57f 100644 --- a/src/vlib/linux/physmem.c +++ b/src/vlib/linux/physmem.c @@ -170,8 +170,13 @@ unix_physmem_region_alloc (vlib_main_t * vm, char *name, u32 size, if (get_mempolicy (&old_mpol, old_mask->maskp, old_mask->size + 1, NULL, 0) == -1) { - error = clib_error_return_unix (0, "get_mempolicy"); - goto error; + if ((flags & VLIB_PHYSMEM_F_FAKE) == 0) + { + error = clib_error_return_unix (0, "get_mempolicy"); + goto error; + } + else + old_mpol = -1; } if ((flags & VLIB_PHYSMEM_F_FAKE) == 0) @@ -246,7 +251,8 @@ unix_physmem_region_alloc (vlib_main_t * vm, char *name, u32 size, goto error; } - numa_set_preferred (numa_node); + if (old_mpol != -1) + numa_set_preferred (numa_node); pr->mem = mmap (0, size, (PROT_READ | PROT_WRITE), mmap_flags, pr->fd, 0); @@ -257,7 +263,8 @@ unix_physmem_region_alloc (vlib_main_t * vm, char *name, u32 size, goto error; } - if (set_mempolicy (old_mpol, old_mask->maskp, old_mask->size + 1) == -1) + if (old_mpol != -1 && + set_mempolicy (old_mpol, old_mask->maskp, old_mask->size + 1) == -1) { error = clib_error_return_unix (0, "set_mempolicy"); goto error; |