numam-spdk/test/env
alokkataria 6d6052ac96 env: Use rte_malloc in spdk_mem_register code path when possible
For TCMalloc regions which we register with spdk at runtime in the MMapHook, we
need to ensure that SPDK doesn't do any allocations in that path otherwise we
will hit a livelock situation. MmapHook is invoked when TCMalloc is out of free
memory and needs to get more memory from the system, for the hugepage case it
gets via mmap.

In the current code, we could end up calling malloc in the spdk_mem_register
call via the following call path.

spdk_mem_register -> spdk_mem_map_set_translation -> spdk_mem_map_get_map_1gb

To avoid this livelock situation we call rte_malloc instead which shouldn't
invoke the system allocator. Note that in try_expand_heap_primary() which is
invoked in the rte_malloc code path, we can still call malloc, so we need to
only use this when dynamic memory allocation is disabled via --legacy-mem.
It is possible in the future we could work around even this limitation,
but for now this implementation will be much simpler.

Have verified this change fixes the livelock condition which I was hitting in
my setup without this fix.

Change-Id: I69d0813a70da1f26f8c4d9d8895e406c026be18b
Signed-off-by: Alok N Kataria <alok.kataria@nutanix.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475943
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2019-12-11 11:05:10 +00:00
..
env_dpdk_post_init env_dpdk: tell spdk_mem_map_init whether legacy_mem was specified 2019-12-11 11:05:10 +00:00
mem_callbacks test/mem_callbacks: Fix compilation on ARM 2019-10-24 19:21:06 +00:00
memory env: Use rte_malloc in spdk_mem_register code path when possible 2019-12-11 11:05:10 +00:00
pci env: add spdk_pci_device_unclaim() 2019-09-18 20:34:39 +00:00
vtophys ut/cunit: added missing semicolon on CU_ASSERT macros 2019-07-24 18:21:22 +00:00
env.sh test/env: convert program calls to run_test 2019-12-10 17:12:03 +00:00
Makefile test: add mem_callbacks unit test 2019-03-12 13:58:57 +00:00