memkind_pmem (3) - Linux Man Pages
memkind_pmem: file-backed memory memkind operations.
NAMEmemkind_pmem.h - file-backed memory memkind operations.
Note: This is EXEPRIMENTAL API. The functionality and the header file itself can be changed (including non-backward compatible changes), or remove.
#include <memkind/internal/memkind_pmem.h> Link with -lmemkind int memkind_pmem_create(struct memkind *kind, const struct memkind_ops *ops, const char *name);
int memkind_pmem_destroy(struct memkind *kind);
void *memkind_pmem_mmap(struct memkind *kind, void *addr, size_t size);
int memkind_pmem_get_mmap_flags(struct memkind *kind, int *flags);
int memkind_pmem_get_size(struct memkind *kind, size_t *total, size_t *free);
The pmem memory memkind operations enable memory kinds built on memory-mapped files. These support traditional volatile memory allocation in a fashion similar to libvmem(3) library. It uses the mmap(2) system call to create a pool of volatile memory. Such memory may have different attributes, depending on the file system containing the memory-mapped files. (See also http://pmem.io/nvml/libvmem).
The pmem memkinds are most useful when used with Direct Access storage (DAX), which is memory-addressable persistent storage that supports load/store access without being paged via the system page cache. A Persistent Memory-aware file system is typically used to provide this type of access.
The most convenient way to create pmem memkinds is to use memkind_create_pmem() (see memkind(3)).
memkind_pmem_create() is an implementation of the memkind "create" operation for file-backed memory kinds. This allocates a space for some pmem-specific metadata, then calls memkind_arena_create() (see memkind_arena(3))
memkind_pmem_destroy() is an implementation of the memkind "destroy" operation for file-backed memory kinds. This releases all of the resources allocated by memkind_pmem_create() and allows the file system space to be reclaimed.
memkind_pmem_mmap() allocates the file system space for a block of size bytes in the memory-mapped file associated with given kind. The addr hint is ignored. The return value is the address of mapped memory region or MAP_FAILED in the case of an error.
memkind_pmem_get_mmap_flags() sets flags to MAP_SHARED. See mmap(2) for more information about these flags.
memkind_pmem_get_size() sets total to the number of bytes of the entire usable space in the memory-mapped file associated with the specified kind, and sets free to the number of unused bytes available in the memory-mapped file.
- The minimum size of the file-backed memory partition.