numam-dpdk/mk
Ilya Maximets 1b72605d24 mem: balanced allocation of hugepages
Currently EAL allocates hugepages one by one not paying attention
from which NUMA node allocation was done.

Such behaviour leads to allocation failure if number of available
hugepages for application limited by cgroups or hugetlbfs and
memory requested not only from the first socket.

Example:
	# 90 x 1GB hugepages availavle in a system

	cgcreate -g hugetlb:/test
	# Limit to 32GB of hugepages
	cgset -r hugetlb.1GB.limit_in_bytes=34359738368 test
	# Request 4GB from each of 2 sockets
	cgexec -g hugetlb:test testpmd --socket-mem=4096,4096 ...

	EAL: SIGBUS: Cannot mmap more hugepages of size 1024 MB
	EAL: 32 not 90 hugepages of size 1024 MB allocated
	EAL: Not enough memory available on socket 1!
	     Requested: 4096MB, available: 0MB
	PANIC in rte_eal_init():
	Cannot init memory

	This happens beacause all allocated pages are
	on socket 0.

Fix this issue by setting mempolicy MPOL_PREFERRED for each hugepage
to one of requested nodes using following schema:

	1) Allocate essential hugepages:
		1.1) Allocate as many hugepages from numa N to
		     only fit requested memory for this numa.
		1.2) repeat 1.1 for all numa nodes.
	2) Try to map all remaining free hugepages in a round-robin
	   fashion.
	3) Sort pages and choose the most suitable.

In this case all essential memory will be allocated and all remaining
pages will be fairly distributed between all requested nodes.

New config option RTE_EAL_NUMA_AWARE_HUGEPAGES introduced and
enabled by default for linuxapp except armv7 and dpaa2.
Enabling of this option adds libnuma as a dependency for EAL.

Fixes: 77988fc08d ("mem: fix allocating all free hugepages")

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-06-30 17:54:32 +02:00
..
arch fix typos using codespell utility 2017-06-14 23:54:13 +02:00
exec-env fix typos using codespell utility 2017-06-14 23:54:13 +02:00
internal mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
machine fix typos using codespell utility 2017-06-14 23:54:13 +02:00
target/generic fix typos using codespell utility 2017-06-14 23:54:13 +02:00
toolchain fix typos using codespell utility 2017-06-14 23:54:13 +02:00
rte.app.mk mem: balanced allocation of hugepages 2017-06-30 17:54:32 +02:00
rte.bsdmodule.mk mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
rte.combinedlib.mk
rte.cpuflags.mk config: make AVX and AVX512 configurable 2017-04-30 23:17:53 +02:00
rte.extapp.mk
rte.extlib.mk
rte.extobj.mk
rte.extshared.mk
rte.extsubdir.mk mk: fix external builds with relative output dir 2017-04-30 22:45:34 +02:00
rte.gnuconfigure.mk mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
rte.hostapp.mk mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
rte.hostlib.mk mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
rte.install.mk mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
rte.lib.mk mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
rte.module.mk mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
rte.obj.mk mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
rte.sdkbuild.mk mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
rte.sdkconfig.mk mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
rte.sdkdepdirs.mk mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
rte.sdkdoc.mk mk: use make silent flag to print HTML doc version 2017-06-27 00:06:02 +02:00
rte.sdkexamples.mk
rte.sdkgcov.mk
rte.sdkinstall.mk mk: fix excluding files when installing docs 2017-06-27 01:16:22 +02:00
rte.sdkroot.mk devtools: add tags and cscope index generation 2017-04-30 12:57:04 +02:00
rte.sdktest.mk mk: fix message when test application is not built 2017-03-27 10:44:53 +02:00
rte.shared.mk mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
rte.subdir.mk mk: optimize directory dependencies 2017-03-27 23:28:43 +02:00
rte.vars.mk fix typos using codespell utility 2017-06-14 23:54:13 +02:00