MEMKIND_PMEM(3)
π MEMKIND_PMEM π
okay bestie, sit down, hydrate, and let's talk about memkind_pmem β it's the memkind operations for file-backed memory. and bestie. it is EXPERIMENTAL. like, the API is experimental, and the header file itself can get changed (yes, even in ways that break your code, non-backward-compatible style π) or straight up removed. so manifest accordingly. no cap.
β¨ NAME β¨
memkind_pmem β file-backed memory memkind operations, duh π
β οΈ heads up: this is EXPERIMENTAL API. the functionality and the header file itself can be changed (including non-backward compatible changes) or removed. i'm not being dramatic, that's literally the warning. π
πΈ SYNOPSIS πΈ
int memkind_pmem_create(struct memkind *kind, 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_validate_dir(const char *dir);
π¦ DESCRIPTION π¦
the pmem memory memkind operations let you build memory kinds on top of memory-mapped files, periodt. they support traditional volatile memory allocation in a way that's similar to the libvmem(3) library. under the hood it uses the mmap(2) system call to create a pool of volatile memory. and here's the cute part β that memory can have different attributes depending on which file system is holding the memory-mapped files. (see also http://pmem.io/pmdk/libvmem.)
the pmem kinds are most useful when used with DAX β that's direct mapping of persistent memory, 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 what you'd use to provide this kind of access. iykyk β¨
the most convenient way to create pmem kinds is to use memkind_create_pmem() or memkind_create_pmem_with_config() (peep memkind(3)).
memkind_pmem_create()β this is the implementation of the memkind "create" operation for file-backed memory kinds. it allocates a space for some pmem-specific metadata, then callsmemkind_arena_create()(seememkind_arena(3)). πmemkind_pmem_destroy()β the implementation of the memkind "destroy" operation for file-backed memory kinds. it releases all of the resources thatmemkind_pmem_create()allocated and lets the file system space be reclaimed. it's giving spring cleaning π§Ήmemkind_pmem_mmap()β allocates the file system space for a block of size bytes in the memory-mapped file associated with the given kind. the addr hint is ignored (sorry girl, it said what it said π). the return value is the address of the mapped memory region, orMAP_FAILEDin the case of an error.memkind_pmem_get_mmap_flags()β sets flags toMAP_SHARED. seemmap(2)for more info about these flags.memkind_pmem_validate_dir()β returns zero if the file created in the specified pmem_dir supports DAX (direct mapping of persistent memory), or an error code from the ERRORS if not. vibe check on your directory, basically π«Ά
π MEMKIND_PMEM_CHUNK_SIZE π
MEMKIND_PMEM_CHUNK_SIZEβ the size of the PMEM chunk size. (yes that's the whole description, it is what it is β)
π COPYRIGHT π
Copyright (C) 2015 - 2020 Intel Corporation. All rights reserved.
π SEE ALSO π
memkind(3), memkind_arena(3), memkind_default(3), memkind_hbw(3), memkind_hugetlb(3), libvmem(3), jemalloc(3), mbind(2), mmap(2)
and that's the whole page bestie, you ate it π β¨ this one came from Intel Corporation, dated 2015-04-21, and it lives in the MEMKIND_PMEM section of your manual. go forth and mmap responsibly, ily ππ¦πΈ
π¦ where this page comes from
- centos-stream 9: memkind-devel 1.11.0-2.el9 Β· BSD
- debian bookworm: libmemkind-dev 1.14.0-2 Β· BSD-3-Clause
- fedora 43: memkind-devel 1.14.0-11.fc43 Β· BSD-2-Clause
- ubuntu jammy: libmemkind-dev 1.13.0-1 Β· BSD-3-Clause
- ubuntu noble: libmemkind-dev 1.14.0-3build1 Β· BSD-3-Clause
- π the page's license: BSD-2-Clause
- Copyright (C) 2014 - 2020 Intel Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms