|
Packit Service |
7f3b24 |
.\" SPDX-License-Identifier: BSD-2-Clause
|
|
Packit Service |
7f3b24 |
.\" Copyright (C) 2014 - 2020 Intel Corporation.
|
|
Packit |
345191 |
.\"
|
|
Packit |
345191 |
.TH "MEMKIND_ARENA" 3 "2015-04-21" "Intel Corporation" "MEMKIND_ARENA" \" -*- nroff -*-
|
|
Packit |
345191 |
.SH "NAME"
|
|
Packit |
345191 |
memkind_arena \- jemalloc arena allocation 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_arena_create(struct memkind " "*kind" ", struct memkind_ops " "*ops" ", const char " "*name" );
|
|
Packit |
345191 |
.BI "int memkind_arena_create_map(struct memkind " "*kind" ", extent_hooks_t " "*hooks" );
|
|
Packit |
345191 |
.BI "int memkind_arena_destroy(struct memkind " "*kind" );
|
|
Packit |
345191 |
.BI "void *memkind_arena_malloc(struct memkind " "*kind" ", size_t " "size" );
|
|
Packit |
345191 |
.BI "void *memkind_arena_calloc(struct memkind " "*kind" ", size_t " "num" ", size_t " "size" );
|
|
Packit |
345191 |
.BI "int memkind_arena_posix_memalign(struct memkind " "*kind" ", void " "**memptr" ", size_t " "alignment" ", size_t " "size" );
|
|
Packit |
345191 |
.BI "void *memkind_arena_realloc(struct memkind " "*kind" ", void " "*ptr" ", size_t " "size" );
|
|
Packit |
345191 |
.BI "void *memkind_arena_realloc_with_kind_detect(void " "*ptr" ", size_t " "size" );
|
|
Packit |
345191 |
.BI "int memkind_thread_get_arena(struct memkind " "*kind" ", unsigned int " "*arena" ", size_t " "size" );
|
|
Packit |
345191 |
.BI "int memkind_bijective_get_arena(struct memkind " "*kind" ", unsigned int " "*arena" ", size_t " "size" );
|
|
Packit |
345191 |
.BI "struct memkind *get_kind_by_arena(unsigned " "arena_ind" );
|
|
Packit |
345191 |
.BI "struct memkind *memkind_arena_detect_kind(void " "*ptr" );
|
|
Packit |
345191 |
.BI "int memkind_arena_finalize(struct memkind " "*kind" );
|
|
Packit |
345191 |
.BI "void memkind_arena_init(struct memkind " "*kind" );
|
|
Packit |
345191 |
.BI "void memkind_arena_free(struct memkind " "*kind" ", void " "*ptr" );
|
|
Packit |
345191 |
.BI "void memkind_arena_free_with_kind_detect(void " "*ptr" );
|
|
Packit |
345191 |
.BI "size_t memkind_arena_malloc_usable_size(void " "*ptr" );
|
|
Packit |
345191 |
.BI "int memkind_arena_update_memory_usage_policy(struct memkind " "*kind" ", memkind_mem_usage_policy " "policy" );
|
|
Packit |
345191 |
.BI "int memkind_arena_enable_background_threads(size_t threads_limit);"
|
|
Packit |
345191 |
.br
|
|
Packit |
345191 |
.SH DESCRIPTION
|
|
Packit |
345191 |
This header file is a collection of functions can be used to populate
|
|
Packit |
345191 |
the memkind operations structure for memory kinds that use jemalloc.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_create ()
|
|
Packit |
345191 |
is an implementation of the memkind "create" operation for memory
|
|
Packit |
345191 |
kinds that use jemalloc. This calls
|
|
Packit |
345191 |
.BR memkind_default_create ()
|
|
Packit |
345191 |
(see
|
|
Packit |
345191 |
.BR memkind_default (3))
|
|
Packit |
345191 |
followed by
|
|
Packit |
345191 |
.BR memkind_arena_create_map ()
|
|
Packit |
345191 |
described below.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_create_map ()
|
|
Packit |
345191 |
creates the
|
|
Packit |
345191 |
.I arena_map
|
|
Packit |
345191 |
array for the memkind structure pointed to by
|
|
Packit |
345191 |
.IR kind
|
|
Packit |
345191 |
which can be indexed by the
|
|
Packit |
345191 |
.BR ops.get_arena ()
|
|
Packit |
345191 |
function from the kind's operations. If get_arena points
|
|
Packit |
345191 |
.BR memkind_thread_get_arena ()
|
|
Packit |
345191 |
then there will be four arenas created for each processor,
|
|
Packit |
345191 |
and if get_arena points to
|
|
Packit |
345191 |
.BR memkind_bijective_get_arena ()
|
|
Packit |
345191 |
then just one arena is created.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_destroy ()
|
|
Packit |
345191 |
is an implementation of the memkind "destroy" operation for memory
|
|
Packit |
345191 |
kinds that use jemalloc. This releases all of the resources
|
|
Packit |
345191 |
allocated by
|
|
Packit |
345191 |
.BR memkind_arena_create ().
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_malloc ()
|
|
Packit |
345191 |
is an implementation of the memkind "malloc" operation for memory
|
|
Packit |
345191 |
kinds that use jemalloc. This allocates memory using the arenas
|
|
Packit |
345191 |
created by
|
|
Packit |
345191 |
.BR memkind_arena_create ()
|
|
Packit |
345191 |
through the jemalloc's
|
|
Packit |
345191 |
.BR mallocx ()
|
|
Packit |
345191 |
interface. It uses the memkind "get_arena" operation to select the
|
|
Packit |
345191 |
arena.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_calloc ()
|
|
Packit |
345191 |
is an implementation of the memkind "calloc" operation for memory
|
|
Packit |
345191 |
kinds that use jemalloc. This allocates memory using the arenas
|
|
Packit |
345191 |
created by
|
|
Packit |
345191 |
.BR memkind_arena_create ()
|
|
Packit |
345191 |
through the jemalloc's
|
|
Packit |
345191 |
.BR mallocx ()
|
|
Packit |
345191 |
interface. It uses the memkind "get_arena" operation to select the
|
|
Packit |
345191 |
arena.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_posix_memalign ()
|
|
Packit |
345191 |
is an implementation of the memkind "posix_memalign" operation for memory
|
|
Packit |
345191 |
kinds that use jemalloc. This allocates memory using the arenas
|
|
Packit |
345191 |
created by
|
|
Packit |
345191 |
.BR memkind_arena_create ()
|
|
Packit |
345191 |
through the jemalloc's
|
|
Packit |
345191 |
.BR mallocx ()
|
|
Packit |
345191 |
interface. It uses the memkind "get_arena" operation to select the
|
|
Packit |
345191 |
arena. The POSIX standard requires that
|
|
Packit |
345191 |
.BR posix_memalign (3)
|
|
Packit |
345191 |
may not set
|
|
Packit |
345191 |
.I errno
|
|
Packit |
345191 |
however the jemalloc's
|
|
Packit |
345191 |
.BR mallocx ()
|
|
Packit |
345191 |
routine may. In an attempt to abide by the standard
|
|
Packit |
345191 |
.I errno
|
|
Packit |
345191 |
is recorded before calling jemalloc's
|
|
Packit |
345191 |
.BR mallocx ()
|
|
Packit |
345191 |
and then reset after the call.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_realloc ()
|
|
Packit |
345191 |
is an implementation of the memkind "realloc" operation for memory
|
|
Packit |
345191 |
kinds that use jemalloc. This allocates memory using the arenas
|
|
Packit |
345191 |
created by
|
|
Packit |
345191 |
.BR memkind_arena_create ()
|
|
Packit |
345191 |
through the jemalloc's
|
|
Packit |
345191 |
.BR mallocx ()
|
|
Packit |
345191 |
interface. It uses the memkind "get_arena" operation to select the
|
|
Packit |
345191 |
arena.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_realloc_with_kind_detect ()
|
|
Packit |
345191 |
function will look up for kind associated to the allocated memory referenced by
|
|
Packit |
345191 |
.I ptr
|
|
Packit |
345191 |
and call (depending on kind value)
|
|
Packit |
345191 |
.BR memkind_arena_realloc ()
|
|
Packit |
345191 |
or
|
|
Packit |
345191 |
.BR memkind_default_realloc ().
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_thread_get_arena ()
|
|
Packit |
345191 |
retrieves the
|
|
Packit |
345191 |
.I arena
|
|
Packit |
345191 |
index that is bound to to the calling thread based on a hash of its
|
|
Packit |
345191 |
thread ID. The
|
|
Packit |
345191 |
.I arena
|
|
Packit |
345191 |
index can be used with the MALLOCX_ARENA macro to set flags for jemalloc's
|
|
Packit |
345191 |
.BR mallocx ().
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_bijective_arena_get_arena ()
|
|
Packit |
345191 |
retrieves the
|
|
Packit |
345191 |
.I arena
|
|
Packit |
345191 |
index to be used with the MALLOCX_ARENA macro to set flags for jemalloc's
|
|
Packit |
345191 |
.BR mallocx ().
|
|
Packit |
345191 |
Use of this operation implies that only one arena is used for the
|
|
Packit |
345191 |
.IR kind .
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_free ()
|
|
Packit |
345191 |
is an implementation of the memkind "free" operation for memory
|
|
Packit |
345191 |
kinds that use jemalloc. It causes the allocated memory referenced by
|
|
Packit |
345191 |
.IR ptr ,
|
|
Packit |
345191 |
which must have been returned by a previous call to
|
|
Packit |
345191 |
.BR memkind_arena_malloc (),
|
|
Packit |
345191 |
.BR memkind_arena_calloc ()
|
|
Packit |
345191 |
or
|
|
Packit |
345191 |
.BR memkind_arena_realloc ()
|
|
Packit |
345191 |
to be made available for future allocations.
|
|
Packit |
345191 |
It uses the memkind "get_arena" operation to select the arena.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_free_with_kind_detect ()
|
|
Packit |
345191 |
function will look up for kind associated to the allocated memory referenced by
|
|
Packit |
345191 |
.I ptr
|
|
Packit |
345191 |
and call
|
|
Packit |
345191 |
.BR memkind_arena_free ().
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_detect_kind ()
|
|
Packit |
345191 |
returns pointer to memory kind structure associated with given allocated memory referenced by
|
|
Packit |
345191 |
.IR ptr .
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR get_kind_by_arena ()
|
|
Packit |
345191 |
returns pointer to memory kind structure associated with given arena.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_malloc_usable_size ()
|
|
Packit |
345191 |
is an implementation of the memkind "usable_size" operation for memory kinds that use jemalloc.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_finalize ()
|
|
Packit |
345191 |
is an implementation of the memkind "finalize" operation for memory kinds that
|
|
Packit |
345191 |
use jemalloc. This function releases all resources allocated by
|
|
Packit |
345191 |
.BR memkind_arena_create ()
|
|
Packit |
345191 |
and it's called when
|
|
Packit |
345191 |
.BR main ()
|
|
Packit |
345191 |
finishes or after calling
|
|
Packit |
345191 |
.BR exit ()
|
|
Packit |
345191 |
function.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_init ()
|
|
Packit |
345191 |
creates arena map with proper hooks per specified kind.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_update_memory_usage_policy ()
|
|
Packit |
345191 |
function changes time, which determine how fast jemalloc returns unused pages back to
|
|
Packit |
345191 |
the operating system, in other words how fast it deallocates file space.
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.BR memkind_arena_enable_background_threads ()
|
|
Packit |
345191 |
enables internal background worker threads in jemalloc.
|
|
Packit |
345191 |
The
|
|
Packit |
345191 |
.I threads_limit
|
|
Packit |
345191 |
specify limit of background threads which will be enabled ( 0 means no limit).
|
|
Packit |
345191 |
.PP
|
|
Packit |
345191 |
.SH "COPYRIGHT"
|
|
Packit Service |
7f3b24 |
Copyright (C) 2014 - 2020 Intel Corporation. All rights reserved.
|
|
Packit |
345191 |
.SH "SEE ALSO"
|
|
Packit |
345191 |
.BR memkind (3),
|
|
Packit |
345191 |
.BR memkind_default (3),
|
|
Packit |
345191 |
.BR memkind_hbw (3),
|
|
Packit |
345191 |
.BR memkind_hugetlb (3),
|
|
Packit |
345191 |
.BR memkind_pmem (3),
|
|
Packit |
345191 |
.BR jemalloc (3),
|
|
Packit |
345191 |
.BR mbind (2),
|
|
Packit |
345191 |
.BR mmap (2)
|