numam-dpdk/lib/librte_eal/common
Anatoly Burakov 66cc45e293 mem: replace memseg with memseg lists
Before, we were aggregating multiple pages into one memseg, so the
number of memsegs was small. Now, each page gets its own memseg,
so the list of memsegs is huge. To accommodate the new memseg list
size and to keep the under-the-hood workings sane, the memseg list
is now not just a single list, but multiple lists. To be precise,
each hugepage size available on the system gets one or more memseg
lists, per socket.

In order to support dynamic memory allocation, we reserve all
memory in advance (unless we're in 32-bit legacy mode, in which
case we do not preallocate memory). As in, we do an anonymous
mmap() of the entire maximum size of memory per hugepage size, per
socket (which is limited to either RTE_MAX_MEMSEG_PER_TYPE pages or
RTE_MAX_MEM_MB_PER_TYPE megabytes worth of memory, whichever is the
smaller one), split over multiple lists (which are limited to
either RTE_MAX_MEMSEG_PER_LIST memsegs or RTE_MAX_MEM_MB_PER_LIST
megabytes per list, whichever is the smaller one). There is also
a global limit of CONFIG_RTE_MAX_MEM_MB megabytes, which is mainly
used for 32-bit targets to limit amounts of preallocated memory,
but can be used to place an upper limit on total amount of VA
memory that can be allocated by DPDK application.

So, for each hugepage size, we get (by default) up to 128G worth
of memory, per socket, split into chunks of up to 32G in size.
The address space is claimed at the start, in eal_common_memory.c.
The actual page allocation code is in eal_memalloc.c (Linux-only),
and largely consists of copied EAL memory init code.

Pages in the list are also indexed by address. That is, in order
to figure out where the page belongs, one can simply look at base
address for a memseg list. Similarly, figuring out IOVA address
of a memzone is a matter of finding the right memseg list, getting
offset and dividing by page size to get the appropriate memseg.

This commit also removes rte_eal_dump_physmem_layout() call,
according to deprecation notice [1], and removes that deprecation
notice as well.

On 32-bit targets due to limited VA space, DPDK will no longer
spread memory to different sockets like before. Instead, it will
(by default) allocate all of the memory on socket where master
lcore is. To override this behavior, --socket-mem must be used.

The rest of the changes are really ripple effects from the memseg
change - heap changes, compile fixes, and rewrites to support
fbarray-backed memseg lists. Due to earlier switch to _walk()
functions, most of the changes are simple fixes, however some
of the _walk() calls were switched to memseg list walk, where
it made sense to do so.

Additionally, we are also switching locks from flock() to fcntl().
Down the line, we will be introducing single-file segments option,
and we cannot use flock() locks to lock parts of the file. Therefore,
we will use fcntl() locks for legacy mem as well, in case someone is
unfortunate enough to accidentally start legacy mem primary process
alongside an already working non-legacy mem-based primary process.

[1] http://dpdk.org/dev/patchwork/patch/34002/

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
2018-04-11 19:55:39 +02:00
..
arch align SPDX Mellanox copyrights 2018-04-11 01:47:47 +02:00
include mem: replace memseg with memseg lists 2018-04-11 19:55:39 +02:00
eal_common_bus.c convert snprintf to strlcpy 2018-04-04 17:33:08 +02:00
eal_common_cpuflags.c lib: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
eal_common_dev.c eal: use SPDX tags in 6WIND copyrighted files 2018-02-01 02:32:41 +01:00
eal_common_devargs.c eal: use SPDX tags in 6WIND copyrighted files 2018-02-01 02:32:41 +01:00
eal_common_errno.c lib: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
eal_common_fbarray.c eal: add shared indexed file-backed array 2018-04-11 19:55:21 +02:00
eal_common_hexdump.c lib: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
eal_common_hypervisor.c align SPDX Mellanox copyrights 2018-04-11 01:47:47 +02:00
eal_common_launch.c lib: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
eal_common_lcore.c eal: provide API for querying valid socket ids 2018-04-05 00:27:13 +02:00
eal_common_log.c eal: register log type and pick level from args 2018-03-30 14:08:44 +02:00
eal_common_memory.c mem: replace memseg with memseg lists 2018-04-11 19:55:39 +02:00
eal_common_memzone.c mem: replace memseg with memseg lists 2018-04-11 19:55:39 +02:00
eal_common_options.c eal: add legacy memory option 2018-04-11 19:55:13 +02:00
eal_common_proc.c eal: add IPC asynchronous request 2018-04-04 23:47:59 +02:00
eal_common_string_fns.c lib: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
eal_common_tailqs.c lib: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
eal_common_thread.c lib: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
eal_common_timer.c lib: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
eal_filesystem.h eal: add shared indexed file-backed array 2018-04-11 19:55:21 +02:00
eal_hugepages.h mem: replace memseg with memseg lists 2018-04-11 19:55:39 +02:00
eal_internal_cfg.h mem: replace memseg with memseg lists 2018-04-11 19:55:39 +02:00
eal_options.h eal: add legacy memory option 2018-04-11 19:55:13 +02:00
eal_private.h mem: move virtual area function in common directory 2018-04-11 19:33:06 +02:00
eal_thread.h lib: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
Makefile eal: add shared indexed file-backed array 2018-04-11 19:55:21 +02:00
malloc_elem.c mem: replace memseg with memseg lists 2018-04-11 19:55:39 +02:00
malloc_elem.h mem: replace memseg with memseg lists 2018-04-11 19:55:39 +02:00
malloc_heap.c mem: replace memseg with memseg lists 2018-04-11 19:55:39 +02:00
malloc_heap.h malloc: support contiguous allocation 2018-04-11 19:43:55 +02:00
meson.build eal: add shared indexed file-backed array 2018-04-11 19:55:21 +02:00
rte_keepalive.c keepalive: fix state alignment 2018-01-25 23:25:57 +01:00
rte_malloc.c mem: replace memseg with memseg lists 2018-04-11 19:55:39 +02:00
rte_reciprocal.c eal: add u64-bit variant for reciprocal divide 2018-01-27 22:34:47 +01:00
rte_service.c add experimental tag to appropriate functions 2018-01-29 23:35:29 +01:00