|
Packit Service |
724aca |
# **MEMKIND**
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
[![Build Status](https://travis-ci.org/memkind/memkind.svg)](https://travis-ci.org/memkind/memkind)
|
|
Packit Service |
724aca |
[![MEMKIND version](https://img.shields.io/github/tag/memkind/memkind.svg)](https://github.com/memkind/memkind/releases/latest)
|
|
Packit Service |
724aca |
[![Coverage Status](http://codecov.io/github/memkind/memkind/coverage.svg?branch=master)](http://codecov.io/gh/memkind/memkind?branch=master)
|
|
Packit Service |
724aca |
[![Packaging status](https://repology.org/badge/tiny-repos/memkind.svg)](https://repology.org/project/memkind/versions)
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
The memkind library is a user extensible heap manager built on top of
|
|
Packit Service |
724aca |
jemalloc which enables control of memory characteristics and a
|
|
Packit Service |
724aca |
partitioning of the heap between kinds of memory. The kinds of memory
|
|
Packit Service |
724aca |
are defined by operating system memory policies that have been applied
|
|
Packit Service |
724aca |
to virtual address ranges. Memory characteristics supported by
|
|
Packit Service |
724aca |
memkind without user extension include control of NUMA and page size
|
|
Packit Service |
724aca |
features. The jemalloc non-standard interface has been extended to
|
|
Packit Service |
724aca |
enable specialized arenas to make requests for virtual memory from the
|
|
Packit Service |
724aca |
operating system through the memkind partition interface. Through the
|
|
Packit Service |
724aca |
other memkind interfaces the user can control and extend memory
|
|
Packit Service |
724aca |
partition features and allocate memory while selecting enabled
|
|
Packit Service |
724aca |
features. Memkind interface allows to create and control file-backed memory
|
|
Packit Service |
724aca |
(PMEM kind) on specified device.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Contents
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
1. [Interfaces](#interfaces)
|
|
Packit Service |
724aca |
2. [Dependencies](#dependencies)
|
|
Packit Service |
724aca |
3. [Building and Installing](#building-and-installing)
|
|
Packit Service |
724aca |
* [jemalloc](#jemalloc)
|
|
Packit Service |
724aca |
4. [Run Requirements](#run-requirements)
|
|
Packit Service |
724aca |
5. [Kind Requirements](#kind-requirements)
|
|
Packit Service |
724aca |
6. [Kernel](#kernel)
|
|
Packit Service |
724aca |
7. [NVDIMM volatile usage](#nvdimm-volatile-usage)
|
|
Packit Service |
724aca |
* [DAX device](#dax-device)
|
|
Packit Service |
724aca |
* [DAX filesystem](#dax-filesystem)
|
|
Packit Service |
724aca |
8. [The Detection Mechanism of the Kind](#the-detection-mechanism-of-the-kind)
|
|
Packit Service |
724aca |
9. [Setting Logging Mechanism](#setting-logging-mechanism)
|
|
Packit Service |
724aca |
10. [Setting Heap Manager](#setting-heap-manager)
|
|
Packit Service |
724aca |
11. [Testing](#testing)
|
|
Packit Service |
724aca |
12. [Simulating High Bandwidth Memory](#simulating-high-bandwidth-memory)
|
|
Packit Service |
724aca |
13. [Notes](#notes)
|
|
Packit Service |
724aca |
14. [Status](#status)
|
|
Packit Service |
724aca |
15. [Disclaimer](#disclaimer)
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Interfaces
|
|
Packit Service |
724aca |
The memkind library delivers four interfaces:
|
|
Packit Service |
724aca |
* hbwmalloc.h - recommended for high-bandwidth memory use cases (stable)
|
|
Packit Service |
724aca |
* memkind.h - generic interface for more complex use cases (stable)
|
|
Packit Service |
724aca |
* pmem_allocator.h - the C++ allocator that satisfies the C++ Allocator
|
|
Packit Service |
724aca |
[requirements](https://en.cppreference.com/w/cpp/named_req/Allocator)
|
|
Packit Service |
724aca |
used for PMEM memory use cases (stable)
|
|
Packit Service |
724aca |
* memkind_allocator.h - the C++ allocator that satisfies the C++ Allocator
|
|
Packit Service |
724aca |
[requirements](https://en.cppreference.com/w/cpp/named_req/Allocator)
|
|
Packit Service |
724aca |
used for static kinds (stable)
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
For more detailed information about those interfaces see
|
|
Packit Service |
724aca |
corresponding manpages (located in man/ subdir):
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
man memkind
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
man hbwmalloc
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
man pmemallocator
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
man memkindallocator
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Dependencies
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
You will need to install required packages on the build system:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
* **autoconf**
|
|
Packit Service |
724aca |
* **automake**
|
|
Packit Service |
724aca |
* **gcc-c++**
|
|
Packit Service |
724aca |
* **libnuma-devel**
|
|
Packit Service |
724aca |
* **libtool**
|
|
Packit Service |
724aca |
* **numactl-devel**
|
|
Packit Service |
724aca |
* **unzip**
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
For using automatic recognition of PMEM NUMA in MEMKIND_DAX_KMEM:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
* **libdaxctl-devel** (v66 or later)
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Building and Installing
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
The memkind library has a dependency on a related fork of jemalloc.
|
|
Packit Service |
724aca |
The configure scripts and gtest source code are distributed with the
|
|
Packit Service |
724aca |
source tarball included in the source RPM, and this tarball is created
|
|
Packit Service |
724aca |
with the memkind "make dist" target. In contrast to the distributed source
|
|
Packit Service |
724aca |
tarball, the git repository does not include any generated files.
|
|
Packit Service |
724aca |
For this reason some additional steps are required when building
|
|
Packit Service |
724aca |
from a checkout of the git repo. Those steps include running
|
|
Packit Service |
724aca |
the bash script called "autogen.sh" prior to configure. This script
|
|
Packit Service |
724aca |
will populate a VERSION file based on "git describe", and use
|
|
Packit Service |
724aca |
autoreconf to generate a configure script.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Building and installing memkind in standard system location can be as simple as
|
|
Packit Service |
724aca |
typing the following while in the root directory of the source tree:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
./autogen.sh
|
|
Packit Service |
724aca |
./configure
|
|
Packit Service |
724aca |
make
|
|
Packit Service |
724aca |
make install
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
To install this library into **other locations**, you can use the prefix variable, e.g.:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
./autogen.sh
|
|
Packit Service |
724aca |
./configure --prefix=/usr
|
|
Packit Service |
724aca |
make
|
|
Packit Service |
724aca |
make install
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
This will install files to /usr/lib, /usr/include, /usr/share/doc/, usr/share/man.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
See the output of:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
./configure --help
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
for more information about either the memkind or the jemalloc configuration options.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## jemalloc
|
|
Packit Service |
724aca |
The jemalloc source was forked from jemalloc version 5.2.1. This source tree
|
|
Packit Service |
724aca |
is located within the jemalloc subdirectory of the memkind source. The jemalloc
|
|
Packit Service |
724aca |
source code has been kept close to the original form, and in particular
|
|
Packit Service |
724aca |
the build system has been lightly modified.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Run Requirements
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
You will need to install required packages for applications,
|
|
Packit Service |
724aca |
which are using the memkind library for dynamic linking at run time:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
* **libnuma**
|
|
Packit Service |
724aca |
* **numactl**
|
|
Packit Service |
724aca |
* **pthread**
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Kind Requirements
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
| Memory kind | NUMA | HBW Memory | Hugepages | Device DAX | Filesystem supporting hole punching |
|
|
Packit Service |
724aca |
| ----------------------------- |:-----:|:-----------:|:---------:|:----------:|:-----------------------------------:|
|
|
Packit Service |
724aca |
| MEMKIND_DEFAULT | | | | | |
|
|
Packit Service |
724aca |
| MEMKIND_HUGETLB | X | X | X | | |
|
|
Packit Service |
724aca |
| MEMKIND_HBW | X | X | | | |
|
|
Packit Service |
724aca |
| MEMKIND_HBW_ALL | X | X | | | |
|
|
Packit Service |
724aca |
| MEMKIND_HBW_HUGETLB | X | X | X | | |
|
|
Packit Service |
724aca |
| MEMKIND_HBW_ALL_HUGETLB | X | X | X | | |
|
|
Packit Service |
724aca |
| MEMKIND_HBW_PREFERRED | X | X | | | |
|
|
Packit Service |
724aca |
| MEMKIND_HBW_PREFERRED_HUGETLB | X | X | X | | |
|
|
Packit Service |
724aca |
| MEMKIND_HBW_INTERLEAVE | X | X | | | |
|
|
Packit Service |
724aca |
| MEMKIND_REGULAR | X | | | | |
|
|
Packit Service |
724aca |
| MEMKIND_DAX_KMEM | X | | | X | |
|
|
Packit Service |
724aca |
| MEMKIND_DAX_KMEM_ALL | X | | | X | |
|
|
Packit Service |
724aca |
| MEMKIND_DAX_KMEM_PREFERRED | X | | | X | |
|
|
Packit Service |
724aca |
| PMEM kind | | | | | X |
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Kernel
|
|
Packit Service |
724aca |
To correctly control of NUMA, huge pages and file-backed memory following
|
|
Packit Service |
724aca |
requirements regarding Linux kernel must be satisfied:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
* **NUMA**
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Requires kernel
|
|
Packit Service |
724aca |
[patch](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3964acd0dbec123aa0a621973a2a0580034b4788)
|
|
Packit Service |
724aca |
introduced in Linux v3.11 that impacts
|
|
Packit Service |
724aca |
functionality of the NUMA system calls. Red Hat has back-ported this patch to the
|
|
Packit Service |
724aca |
v3.10 kernel in the RHEL 7.0 GA release, so RHEL 7.0 onward supports
|
|
Packit Service |
724aca |
memkind even though this kernel version predates v3.11.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
* **Hugepages**
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Functionality related to hugepages allocation require patches
|
|
Packit Service |
724aca |
[patch1](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e0ec90ee7e6f6cbaa6d59ffb48d2a7af5e80e61d) and
|
|
Packit Service |
724aca |
[patch2](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=099730d67417dfee273e9b10ac2560ca7fac7eb9)
|
|
Packit Service |
724aca |
Without them physical memory may end up being located on incorrect NUMA node.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
* **2MB Pages**
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
To use the interfaces for obtaining 2MB pages please be sure to follow the instructions
|
|
Packit Service |
724aca |
[here](https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt) and pay particular
|
|
Packit Service |
724aca |
attention to the use of the procfs files:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
/proc/sys/vm/nr_hugepages
|
|
Packit Service |
724aca |
/proc/sys/vm/nr_overcommit_hugepages
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
for enabling the kernel's huge page pool.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
* **Filesystem supporting hole punching**
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
To use the PMEM kind, please be sure that filesystem which is used for PMEM creation supports
|
|
Packit Service |
724aca |
[FALLOC_FL_PUNCH_HOLE](http://man7.org/linux/man-pages/man2/fallocate.2.html) flag.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
* **Device DAX**
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
To use MEMKIND_DAX_KMEM_* kinds you need at least Linux Kernel 5.1 (with enabled DEV_DAX_KMEM Kernel option) and created DAX device.
|
|
Packit Service |
724aca |
If you have loaded dax_pmem_compat module instead of dax_pmem, please read
|
|
Packit Service |
724aca |
[this](https://pmem.io/ndctl/daxctl-migrate-device-model.html) article and migrate device model
|
|
Packit Service |
724aca |
to use alternative device dax drivers, e.g. kmem.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
If you want to migrate device model type:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
daxctl migrate-device-model
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
To create a new DAX device you can type:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
ndctl create-namespace --mode=devdax --map=mem
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
To display a list of created devices:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
ndctl list
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
If you have already created device in another mode, you can reconfigure the device using:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
ndctl create-namespace --mode=devdax --map=mem --force -e namespaceX.Y
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Where namespaceX.Y means namespace you want to reconfigure.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
For more details about creating new namespace read [this](https://pmem.io/ndctl/ndctl-create-namespace.html).
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Conversion from device dax to NUMA node can be performed using following commands:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
daxctl reconfigure-device daxX.Y --mode=system-ram
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Where daxX.Y is DAX device you want to reconfigure.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
This will migrate device from device_dax to kmem driver. After this step daxctl should be able to
|
|
Packit Service |
724aca |
see devices in system-ram mode:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
daxctl list
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Example output after reconfigure dax2.0 as system-ram:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
[
|
|
Packit Service |
724aca |
{
|
|
Packit Service |
724aca |
"chardev":"dax1.0",
|
|
Packit Service |
724aca |
"size":263182090240,
|
|
Packit Service |
724aca |
"target_node":3,
|
|
Packit Service |
724aca |
"mode":"devdax"
|
|
Packit Service |
724aca |
},
|
|
Packit Service |
724aca |
{
|
|
Packit Service |
724aca |
"chardev":"dax2.0",
|
|
Packit Service |
724aca |
"size":263182090240,
|
|
Packit Service |
724aca |
"target_node":4,
|
|
Packit Service |
724aca |
"mode":"system-ram"
|
|
Packit Service |
724aca |
}
|
|
Packit Service |
724aca |
]
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Also you should be able to check new NUMA node configuration by:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
numactl -H
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Example output, where NUMA node 4 is NUMA node created from persistent memory:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
available: 3 nodes (0-1,4)
|
|
Packit Service |
724aca |
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
|
Packit Service |
724aca |
node 0 size: 192112 MB
|
|
Packit Service |
724aca |
node 0 free: 185575 MB
|
|
Packit Service |
724aca |
node 1 cpus: 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
|
Packit Service |
724aca |
node 1 size: 193522 MB
|
|
Packit Service |
724aca |
node 1 free: 193107 MB
|
|
Packit Service |
724aca |
node 4 cpus:
|
|
Packit Service |
724aca |
node 4 size: 250880 MB
|
|
Packit Service |
724aca |
node 4 free: 250879 MB
|
|
Packit Service |
724aca |
node distances:
|
|
Packit Service |
724aca |
node 0 1 4
|
|
Packit Service |
724aca |
0: 10 21 17
|
|
Packit Service |
724aca |
1: 21 10 28
|
|
Packit Service |
724aca |
4: 17 28 10
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## NVDIMM volatile usage
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Memkind supports using persistent memory as an extension of DRAM.
|
|
Packit Service |
724aca |
This volatile memory solution is provided by the library with two separate ways described below.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## DAX device
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
NVDIMM memory as DAX device is supported by MEMKIND_DAX_KMEM_* kinds. With this solution
|
|
Packit Service |
724aca |
persistent memory will be seen in OS as separate NUMA nodes.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Memkind allows two ways to use this kind:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
- first implicitly, by allowing memkind library for automatic recognition of NUMA nodes
|
|
Packit Service |
724aca |
created from persistent memory using [libdaxctl-devel](#dependencies)
|
|
Packit Service |
724aca |
- secondary explicitly, by using MEMKIND_DAX_KMEM_NODES environment variable set to
|
|
Packit Service |
724aca |
comma separated list of NUMA nodes which will be treated as NUMA nodes created from persistent memory,
|
|
Packit Service |
724aca |
this solution overrides the first one
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## DAX filesystem
|
|
Packit Service |
724aca |
PMEM kind supports the traditional malloc/free interfaces on a memory mapped file.
|
|
Packit Service |
724aca |
This allows the use of [persistent memory](https://pmem.io/)
|
|
Packit Service |
724aca |
as volatile memory, for cases where the region of persistent memory
|
|
Packit Service |
724aca |
is useful to an application, but when the application doesn't need it to be persistent.
|
|
Packit Service |
724aca |
PMEM kind is most useful when used with Direct Access storage
|
|
Packit Service |
724aca |
[DAX](https://www.kernel.org/doc/Documentation/filesystems/dax.txt), which is
|
|
Packit Service |
724aca |
memory-addressable persistent storage that supports load/store access without being paged via the system page cache.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Application using memkind library supports managing a data placement:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
| Data placement | Memory kind |
|
|
Packit Service |
724aca |
|----------------|---------------------------|
|
|
Packit Service |
724aca |
| PMEM (fsdax) | PMEM kind |
|
|
Packit Service |
724aca |
| PMEM (devdax) | MEMKIND_DAX_KMEM kind |
|
|
Packit Service |
724aca |
| DRAM | e.g. MEMKIND_DEFAULT kind |
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Currently, the PMEM kind is supported only by the jemalloc heap manager.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## The Detection Mechanism of the Kind
|
|
Packit Service |
724aca |
One of the notable features of the memkind is to detect the correct kind of previously allocated memory.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
| Operations | Memkind API function |
|
|
Packit Service |
724aca |
|---------------------------------------------|----------------------------------------|
|
|
Packit Service |
724aca |
| Freeing memory | memkind_free(kind, ptr) |
|
|
Packit Service |
724aca |
| Reallocating memory | memkind_realloc(kind, ptr, size) |
|
|
Packit Service |
724aca |
| Obtaining the size of allocated memory | memkind_malloc_usable_size(kind, ptr) |
|
|
Packit Service |
724aca |
| Reallocating memory to reduce fragmentation | memkind_defrag_reallocate(kind, ptr) |
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
Operations above could be unified for all used memory kinds
|
|
Packit Service |
724aca |
by passing a NULL value as a kind to the functions mentioned above.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
For more details, please see the following
|
|
Packit Service |
724aca |
[example](https://github.com/memkind/memkind/blob/master/examples/pmem_free_with_unknown_kind.c).
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
**Important Notes:**
|
|
Packit Service |
724aca |
The look up for correct kind could result in serious performance penalty,
|
|
Packit Service |
724aca |
which can be avoided by specifying a correct kind explicitly.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Setting Logging Mechanism
|
|
Packit Service |
724aca |
In memkind library logging mechanism could be enabled by setting MEMKIND_DEBUG
|
|
Packit Service |
724aca |
environment variable. Setting MEMKIND_DEBUG to "1" enables printing messages
|
|
Packit Service |
724aca |
like errors and general information about environment to stderr.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Setting Heap Manager
|
|
Packit Service |
724aca |
In memkind library heap management can be adjusted with MEMKIND_HEAP_MANAGER
|
|
Packit Service |
724aca |
environment variable, which allows for switching to one of the available
|
|
Packit Service |
724aca |
heap managers.
|
|
Packit Service |
724aca |
Values:
|
|
Packit Service |
724aca |
- JEMALLOC - sets the jemalloc heap manager
|
|
Packit Service |
724aca |
- TBB - sets Intel Threading Building Blocks heap manager. This option requires installed
|
|
Packit Service |
724aca |
Intel Threading Building Blocks library.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
If the MEMKIND_HEAP_MANAGER is not set then the jemalloc heap manager will be used by default.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Testing
|
|
Packit Service |
724aca |
All existing tests pass. For more information on how to execute tests
|
|
Packit Service |
724aca |
see the [CONTRIBUTING](CONTRIBUTING) file.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
When tests are run on a NUMA platform without high bandwidth memory
|
|
Packit Service |
724aca |
the MEMKIND_HBW_NODES environment variable is used in conjunction with
|
|
Packit Service |
724aca |
"numactl --membind" to force standard allocations to one NUMA node and
|
|
Packit Service |
724aca |
high bandwidth allocations through a different NUMA node. See next
|
|
Packit Service |
724aca |
section for more details.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Simulating High Bandwidth Memory
|
|
Packit Service |
724aca |
A method for testing for the benefit of high bandwidth memory on a
|
|
Packit Service |
724aca |
dual socket Intel(R) Xeon(TM) system is to use the QPI bus to simulate
|
|
Packit Service |
724aca |
slow memory. This is not an accurate model of the bandwidth and
|
|
Packit Service |
724aca |
latency characteristics of the Intel's 2nd generation Intel(R) Xeon Phi(TM)
|
|
Packit Service |
724aca |
Product Family on package memory, but is a reasonable way to determine
|
|
Packit Service |
724aca |
which data structures rely critically on bandwidth.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
If the application a.out has been modified to use high bandwidth
|
|
Packit Service |
724aca |
memory with the memkind library then this can be done with numactl as
|
|
Packit Service |
724aca |
follows with the bash shell:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
export MEMKIND_HBW_NODES=0
|
|
Packit Service |
724aca |
numactl --membind=1 --cpunodebind=0 a.out
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
or with csh:
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
setenv MEMKIND_HBW_NODES 0
|
|
Packit Service |
724aca |
numactl --membind=1 --cpunodebind=0 a.out
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
The MEMKIND_HBW_NODES environment variable set to zero will bind high
|
|
Packit Service |
724aca |
bandwidth allocations to NUMA node 0. The --membind=1 flag to numactl
|
|
Packit Service |
724aca |
will bind standard allocations, static and stack variables to NUMA
|
|
Packit Service |
724aca |
node 1. The --cpunodebind=0 option to numactl will bind the process
|
|
Packit Service |
724aca |
threads to CPUs associated with NUMA node 0. With this configuration
|
|
Packit Service |
724aca |
standard allocations will be fetched across the QPI bus, and high
|
|
Packit Service |
724aca |
bandwidth allocations will be local to the process CPU.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Notes
|
|
Packit Service |
724aca |
* Using memkind with Transparent Huge Pages enabled may result in
|
|
Packit Service |
724aca |
undesirably high memory footprint. To avoid that disable THP using following
|
|
Packit Service |
724aca |
[instruction](https://www.kernel.org/doc/Documentation/vm/transhuge.txt)
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Status
|
|
Packit Service |
724aca |
Different interfaces can represent different maturity level
|
|
Packit Service |
724aca |
(as described in corresponding man pages).
|
|
Packit Service |
724aca |
Feedback on design and implementation is greatly appreciated.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
## Disclaimer
|
|
Packit Service |
724aca |
SEE [COPYING](COPYING) FILE FOR LICENSE INFORMATION.
|
|
Packit Service |
724aca |
|
|
Packit Service |
724aca |
THIS SOFTWARE IS PROVIDED AS A DEVELOPMENT SNAPSHOT TO AID
|
|
Packit Service |
724aca |
COLLABORATION AND WAS NOT ISSUED AS A RELEASED PRODUCT BY INTEL.
|