[PATCH v3 1/6] doc: add hugepage mapping details
Burakov, Anatoly
anatoly.burakov at intel.com
Tue Feb 8 16:28:52 CET 2022
On 03-Feb-22 6:13 PM, Dmitry Kozlyuk wrote:
> Hugepage mapping is a layer of EAL malloc builds upon.
> There were implicit references to its details,
> like mentions of segment file descriptors,
> but no explicit description of its modes and operation.
> Add an overview of mechanics used on ech supported OS.
> Convert memory management subsections from list items
> to level 4 headers: they are big and important enough.
>
> Signed-off-by: Dmitry Kozlyuk <dkozlyuk at nvidia.com>
> Acked-by: Bruce Richardson <bruce.richardson at intel.com>
> ---
> +In dynamic memory mode, EAL removes a backing hugepage file
> +when all pages mapped from it are freed back to the system.
> +However, backing files may persist after the application terminates
> +in case of a crash or a leak of DPDK memory (e.g. ``rte_free()`` is missing).
> +This reduces the number of hugepages available to other processes
> +as reported by ``/sys/kernel/mm/hugepages/hugepages-*/free_hugepages``.
> +EAL can remove the backing files after opening them for mapping
> +if ``--huge-unlink`` is given to avoid polluting hugetlbfs.
> +However, since it disables multi-process anyway,
> +using anonymous mapping (``--in-memory``) is recommended instead.
> +
> +:ref:`EAL memory allocator <malloc>` relies on hugepages being zero-filled.
> +Hugepages are cleared by the kernel when a file in hugetlbfs or its part
> +is mapped for the first time system-wide
> +to prevent data leaks from previous users of the same hugepage.
> +EAL ensures this behavior by removing existing backing files at startup
> +and by recreating them before opening for mapping (as a precaution).
> +
> +Anonymous mapping does not allow multi-process architecture.
> +This mode does not use hugetlbfs
> +and thus does not require root permissions for memory management
> +(the limit of locked memory amount, ``MEMLOCK``, still applies).
> +It is free of filename conflict and leftover file issues.
> +If memfd_create(2) is supported both at build and run time,
Nitpick, quote memfd? e.g. `memfd_create(2)`
Otherwise,
Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
--
Thanks,
Anatoly
More information about the dev
mailing list