Blame man/memkind_pmem.3

Packit 345191
.\"
Packit 345191
.\" Copyright (C) 2014 - 2019 Intel Corporation.
Packit 345191
.\" All rights reserved.
Packit 345191
.\"
Packit 345191
.\" Redistribution and use in source and binary forms, with or without
Packit 345191
.\" modification, are permitted provided that the following conditions are met:
Packit 345191
.\" 1. Redistributions of source code must retain the above copyright notice(s),
Packit 345191
.\"    this list of conditions and the following disclaimer.
Packit 345191
.\" 2. Redistributions in binary form must reproduce the above copyright notice(s),
Packit 345191
.\"    this list of conditions and the following disclaimer in the documentation
Packit 345191
.\"    and/or other materials provided with the distribution.
Packit 345191
.\"
Packit 345191
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
Packit 345191
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
Packit 345191
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
Packit 345191
.\" EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
Packit 345191
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit 345191
.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Packit 345191
.\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
Packit 345191
.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
Packit 345191
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
Packit 345191
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 345191
.\"
Packit 345191
.TH "MEMKIND_PMEM" 3 "2015-04-21" "Intel Corporation" "MEMKIND_PMEM" \" -*- nroff -*-
Packit 345191
.SH "NAME"
Packit 345191
memkind_pmem \- file-backed memory memkind operations.
Packit 345191
.br
Packit 345191
.BR Note:
Packit 345191
This is EXPERIMENTAL API. The functionality and the header file itself can be changed (including non-backward compatible changes) or removed.
Packit 345191
.SH "SYNOPSIS"
Packit 345191
.sp
Packit 345191
.BI "int memkind_pmem_create(struct memkind " "*kind" ", struct memkind_ops " "*ops" ", const char " "*name" );
Packit 345191
.br
Packit 345191
.BI "int memkind_pmem_destroy(struct memkind " "*kind" );
Packit 345191
.br
Packit 345191
.BI "void *memkind_pmem_mmap(struct memkind " "*kind" ", void " "*addr" ", size_t " "size" );
Packit 345191
.br
Packit 345191
.BI "int memkind_pmem_get_mmap_flags(struct memkind " "*kind" ", int " "*flags" );
Packit 345191
.br
Packit 345191
.SH DESCRIPTION
Packit 345191
.PP
Packit 345191
The pmem memory memkind operations enable memory kinds built on memory-mapped
Packit 345191
files.  These support traditional
Packit 345191
.B volatile
Packit 345191
memory allocation in a fashion similar to
Packit 345191
.BR libvmem (3)
Packit 345191
library.  It uses the
Packit 345191
.BR mmap (2)
Packit 345191
system call to create a pool of volatile memory.  Such memory may have different
Packit 345191
attributes, depending on the file system containing the memory-mapped files.
Packit 345191
(See also
Packit 345191
.IR http://pmem.io/pmdk/libvmem ).
Packit 345191
.PP
Packit 345191
The pmem memkinds are most useful when used with
Packit 345191
.I Direct Access
Packit 345191
storage (DAX), which is memory-addressable persistent storage
Packit 345191
that supports load/store access without being paged via the system page cache.
Packit 345191
A Persistent Memory-aware file system is typically used to provide this
Packit 345191
type of access.
Packit 345191
.PP
Packit 345191
The most convenient way to create pmem memkinds is to use
Packit 345191
.BR memkind_create_pmem ()
Packit 345191
or
Packit 345191
.BR memkind_create_pmem_with_config ()
Packit 345191
(see
Packit 345191
.BR memkind (3)).
Packit 345191
.PP
Packit 345191
.BR memkind_pmem_create ()
Packit 345191
is an implementation of the memkind "create" operation for file-backed memory
Packit 345191
kinds.  This allocates a space for some pmem-specific metadata, then calls
Packit 345191
.BR memkind_arena_create ()
Packit 345191
(see
Packit 345191
.BR memkind_arena (3))
Packit 345191
.PP
Packit 345191
.BR memkind_pmem_destroy ()
Packit 345191
is an implementation of the memkind "destroy" operation for file-backed memory
Packit 345191
kinds.  This releases all of the resources
Packit 345191
allocated by
Packit 345191
.BR memkind_pmem_create ()
Packit 345191
and allows the file system space to be reclaimed.
Packit 345191
.PP
Packit 345191
.BR memkind_pmem_mmap ()
Packit 345191
allocates the file system space for a block of
Packit 345191
.I size
Packit 345191
bytes in the memory-mapped file associated with given kind.
Packit 345191
The
Packit 345191
.I addr
Packit 345191
hint is ignored.  The return value is the address of mapped memory region or
Packit 345191
.B MAP_FAILED
Packit 345191
in the case of an error.
Packit 345191
.PP
Packit 345191
.BR memkind_pmem_get_mmap_flags ()
Packit 345191
sets
Packit 345191
.I flags
Packit 345191
to
Packit 345191
.BR "MAP_SHARED" .
Packit 345191
See
Packit 345191
.BR mmap (2)
Packit 345191
for more information about these flags.
Packit 345191
.TP
Packit 345191
.B MEMKIND_PMEM_CHUNK_SIZE
Packit 345191
The size of the PMEM chunk size.
Packit 345191
.SH "COPYRIGHT"
Packit 345191
Copyright (C) 2015 - 2019 Intel Corporation. All rights reserved.
Packit 345191
.SH "SEE ALSO"
Packit 345191
.BR memkind (3),
Packit 345191
.BR memkind_arena (3),
Packit 345191
.BR memkind_default (3),
Packit 345191
.BR memkind_hbw (3),
Packit 345191
.BR memkind_hugetlb (3),
Packit 345191
.BR libvmem (3),
Packit 345191
.BR jemalloc (3),
Packit 345191
.BR mbind (2),
Packit 345191
.BR mmap (2)