[dpdk-dev] [PATCH 18/41] test: fix malloc autotest to support memory hotplug

Olivier Matz olivier.matz at 6wind.com
Mon Mar 19 18:49:27 CET 2018


On Sat, Mar 03, 2018 at 01:46:06PM +0000, Anatoly Burakov wrote:
> The test was expecting memory already being allocated on all sockets,
> and thus was failing because calling rte_malloc could trigger memory
> hotplug event and allocate memory where there was none before.
> 
> Fix it to instead report availability of memory on specific sockets
> by attempting to allocate a page and see if that succeeds. Technically,
> this can still cause failure as memory might not be available at the
> time of check, but become available by the time the test is run, but
> this is a corner case not worth considering.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
> ---
>  test/test/test_malloc.c | 52 +++++++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 44 insertions(+), 8 deletions(-)
> 
> diff --git a/test/test/test_malloc.c b/test/test/test_malloc.c
> index 8484fb6..2aaf1b8 100644
> --- a/test/test/test_malloc.c
> +++ b/test/test/test_malloc.c
> @@ -22,6 +22,8 @@
>  #include <rte_random.h>
>  #include <rte_string_fns.h>
>  
> +#include "../../lib/librte_eal/common/eal_memalloc.h"
> +

I guess there is no way to test without importing a private EAL
function, correct? If yes, maybe it deserves a quick explanation.


More information about the dev mailing list