]> git.droids-corp.org - dpdk.git/commit
eal/linux: allow hugepage file reuse
authorDmitry Kozlyuk <dkozlyuk@nvidia.com>
Thu, 3 Feb 2022 18:13:35 +0000 (20:13 +0200)
committerDavid Marchand <david.marchand@redhat.com>
Tue, 8 Feb 2022 20:32:53 +0000 (21:32 +0100)
commit32b4771cd8ef377c039d895d034b3b5e86ee34d2
tree789fd291872763c2bee86939bdabe2b22e17722f
parent52d7d91ed44c6c03f2ea24416bee5a15f5929019
eal/linux: allow hugepage file reuse

Linux EAL ensured that mapped hugepages are clean
by always mapping from newly created files:
existing hugepage backing files were always removed.
In this case, the kernel clears the page to prevent data leaks,
because the mapped memory may contain leftover data
from the previous process that was using this memory.
Clearing takes the bulk of the time spent in mmap(2),
increasing EAL initialization time.

Introduce a mode to keep existing files and reuse them
in order to speed up initial memory allocation in EAL.
Hugepages mapped from such files may contain data
left by the previous process that used this memory,
so RTE_MEMSEG_FLAG_DIRTY is set for their segments.
If multiple hugepages are mapped from the same file:
1. When fallocate(2) is used, all memory mapped from this file
   is considered dirty, because it is unknown
   which parts of the file are holes.
2. When ftruncate(3) is used, memory mapped from this file
   is considered dirty unless the file is extended
   to create a new mapping, which implies clean memory.

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
lib/eal/common/eal_common_options.c
lib/eal/common/eal_internal_cfg.h
lib/eal/linux/eal.c
lib/eal/linux/eal_hugepage_info.c
lib/eal/linux/eal_memalloc.c