176
Memory block size:
2G
Total online memory:
390G
Total offline memory:
0B
To programmatically allocate memory from a NUMA node created using persistent
memory, a new static kind, called MEMKIND_DAX_KMEM, was added to libmemkind
that uses the system-ram DAX device.
Using MEMKIND_DAX_KMEM as the first argument to memkind_malloc(), shown below,
you can use persistent memory from separate NUMA nodes in a single application.
The persistent memory is still physically connected to a CPU socket, so the application
should take care to ensure CPU affinity for optimal performance.
memkind_malloc(MEMKIND_DAX_KMEM, size_t size)
Figure 10-3 shows an application that created two static kind objects: MEMKIND_
DEFAULT and MEMKIND_DAX_KMEM.
The difference between the PMEM_KIND described earlier and MEMKIND_DAX_
KMEM is that the MEMKIND_DAX_KMEM is a static kind and uses mmap() with the
MAP_PRIVATE flag, while the dynamic PMEM_KIND is created with memkind_create_
pmem() and uses the MAP_SHARED flag when memory-mapping files on a DAXenabled file system.
Figure 10-3. An application that created two kind objects from different types of
memory
Chapter 10 Volatile Use of persistent MeMory
Memory block size:
2G
Total online memory:
390G
Total offline memory:
0B
To programmatically allocate memory from a NUMA node created using persistent
memory, a new static kind, called MEMKIND_DAX_KMEM, was added to libmemkind
that uses the system-ram DAX device.
Using MEMKIND_DAX_KMEM as the first argument to memkind_malloc(), shown below,
you can use persistent memory from separate NUMA nodes in a single application.
The persistent memory is still physically connected to a CPU socket, so the application
should take care to ensure CPU affinity for optimal performance.
memkind_malloc(MEMKIND_DAX_KMEM, size_t size)
Figure 10-3 shows an application that created two static kind objects: MEMKIND_
DEFAULT and MEMKIND_DAX_KMEM.
The difference between the PMEM_KIND described earlier and MEMKIND_DAX_
KMEM is that the MEMKIND_DAX_KMEM is a static kind and uses mmap() with the
MAP_PRIVATE flag, while the dynamic PMEM_KIND is created with memkind_create_
pmem() and uses the MAP_SHARED flag when memory-mapping files on a DAXenabled file system.
Figure 10-3. An application that created two kind objects from different types of
memory
Chapter 10 Volatile Use of persistent MeMory
