@@ -16,47 +16,56 @@ extern "C" {
16
16
17
17
#define UMF_OS_RESULTS_START_FROM 1000
18
18
19
+ /// @brief Protection of the memory allocations
19
20
typedef enum umf_mem_protection_flags_t {
20
- UMF_PROTECTION_NONE = (1 << 0 ),
21
- UMF_PROTECTION_READ = (1 << 1 ),
22
- UMF_PROTECTION_WRITE = (1 << 2 ),
23
- UMF_PROTECTION_EXEC = (1 << 3 ),
21
+ UMF_PROTECTION_NONE = (1 << 0 ), ///< Memory allocations can not be accessed
22
+ UMF_PROTECTION_READ = (1 << 1 ), ///< Memory allocations can be read.
23
+ UMF_PROTECTION_WRITE = (1 << 2 ), ///< Memory allocations can be written.
24
+ UMF_PROTECTION_EXEC = (1 << 3 ), ///< Memory allocations can be executed.
24
25
25
26
UMF_PROTECTION_MAX // must be the last one
26
27
} umf_mem_protection_flags_t ;
27
28
29
+ /// @brief Visibility of the memory allocations
28
30
typedef enum umf_mem_visibility_t {
29
- UMF_VISIBILITY_SHARED ,
30
- UMF_VISIBILITY_PRIVATE ,
31
+ UMF_VISIBILITY_SHARED , ///< Updates to the memory allocated using OS provider are visible to other processes.
32
+ /// TODO: need to expose functionality to share open the mapping in other process and explicit sync?
33
+ UMF_VISIBILITY_PRIVATE , ///< Updates to the memory allocated using OS provider are not visible to other proceses.
31
34
} umf_mem_visibility_t ;
32
35
36
+ /// @brief Memory binding mode
37
+ ///
38
+ /// Specifies how memory is bound to NUMA nodes on systems that support NUMA.
39
+ /// Not every mode is supported on every system.
33
40
typedef enum umf_numa_mode_t {
34
- UMF_NUMA_MODE_DEFAULT ,
35
- UMF_NUMA_MODE_BIND ,
36
- UMF_NUMA_MODE_INTERLEAVE ,
37
- UMF_NUMA_MODE_PREFERRED ,
38
- UMF_NUMA_MODE_LOCAL ,
41
+ UMF_NUMA_MODE_DEFAULT , ///< Default binding mode. Actual binding policy is system-specific.
42
+ /// On linux this corresponds to MPOL_DEFAULT. If this mode is specified,
43
+ /// nodemask must be NULL and maxnode must be 0.
44
+ UMF_NUMA_MODE_BIND , ///< Restricts memory allocation to nodes specified in nodemask. Allocations
45
+ /// might come from any of the allowed nodes.
46
+ UMF_NUMA_MODE_INTERLEAVE , ///< Interleaves memory allocations across the set of nodes specified in nodemask.
47
+ UMF_NUMA_MODE_PREFERRED , ///< Specifies preferred node for allocation. If allocation cannot be fulfilled,
48
+ /// memory will be allocated from other nodes.
49
+ UMF_NUMA_MODE_LOCAL , ///< The memory is allocated on the node of the CPU that triggered the allocation.
50
+ /// If this mode is specified, nodemask must be NULL and maxnode must be 0.
51
+ /// TODO: should this be a hint or strict policy?
39
52
} umf_numa_mode_t ;
40
53
41
- typedef enum umf_purge_advise_t {
42
- UMF_PURGE_LAZY ,
43
- UMF_PURGE_FORCE ,
44
- } umf_purge_advise_t ;
45
-
46
54
/// @brief Memory provider settings struct
47
55
typedef struct umf_os_memory_provider_params_t {
48
56
/// combination of 'umf_mem_protection_flags_t' flags
49
57
unsigned protection ;
58
+
50
59
/// shared or private visibility of memory mapped by a provider
51
- /// sets MAP_SHARED and MAP_PRIVATE flags respectively on internal mmap() calls
52
60
umf_mem_visibility_t visibility ;
53
61
54
62
// NUMA config
55
- /// nodemask used in internal mbind() calls
63
+ /// points to a bit mask of nodes containing up to maxnode bits, depending on
64
+ /// selected numa_mode newly allocated memory will be bound to those nodes
56
65
unsigned long * nodemask ;
57
- /// maximum number of nodes in \p nodemask
66
+ /// max number of bits in nodemask
58
67
unsigned long maxnode ;
59
- /// flag that relates to one of the MPOL_* flags used in internal mbind() calls
68
+ /// describes how nodemask is interpreted
60
69
umf_numa_mode_t numa_mode ;
61
70
62
71
// others
0 commit comments