mem: fix undefined behavior in NUMA-aware mapping
authorAnatoly Burakov <anatoly.burakov@intel.com>
Fri, 21 Sep 2018 09:27:22 +0000 (10:27 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 3 Oct 2018 22:33:58 +0000 (00:33 +0200)
commitb1621823eacbe4669a4b581d6c420db08f9e6505
treea683c89a0ab1e988545cb45cf6c35ba84a3dcf74
parent64cdfc35aaad37f6d6f59564233985a27d31a13d
mem: fix undefined behavior in NUMA-aware mapping

When NUMA-aware hugepages config option is set, we rely on
libnuma to tell the kernel to allocate hugepages on a specific
NUMA node. However, we allocate node mask before we check if
NUMA is available in the first place, which, according to
the manpage [1], causes undefined behaviour.

Fix by only using nodemask when we have NUMA available.

[1] https://linux.die.net/man/3/numa_alloc_onnode

Bugzilla ID: 20
Fixes: 1b72605d2416 ("mem: balanced allocation of hugepages")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
lib/librte_eal/linuxapp/eal/eal_memory.c