Skip to content

Commit fcac20b

Browse files
authored
Merge pull request #538 from lplewa/split
add umf split mode to os_memory_provider
2 parents fde2a38 + ae7b3f8 commit fcac20b

File tree

5 files changed

+526
-42
lines changed

5 files changed

+526
-42
lines changed

include/umf/providers/provider_os_memory.h

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,26 @@ typedef enum umf_numa_mode_t {
5757
/// fulfilled, memory will be allocated from other nodes.
5858
UMF_NUMA_MODE_PREFERRED,
5959

60+
/// Allocation will be split evenly across nodes specified in nodemask.
61+
/// umf_numa_split_partition_t can be passed in umf_os_memory_provider_params_t structure
62+
/// to specify other distribution.
63+
UMF_NUMA_MODE_SPLIT,
6064
/// The memory is allocated on the node of the CPU that triggered the
6165
/// allocation. If this mode is specified, nodemask must be NULL and
6266
/// maxnode must be 0.
6367
UMF_NUMA_MODE_LOCAL, // TODO: should this be a hint or strict policy?
6468
} umf_numa_mode_t;
6569

70+
/// @brief This structure specifies a user-defined page distribution
71+
/// within a single allocation in UMF_NUMA_MODE_SPLIT mode.
72+
typedef struct umf_numa_split_partition_t {
73+
/// The weight of the partition, representing the proportion of
74+
/// the allocation that should be assigned to this NUMA node.
75+
unsigned weight;
76+
/// The NUMA node where the pages assigned to this partition will be bound.
77+
unsigned target;
78+
} umf_numa_split_partition_t;
79+
6680
/// @brief Memory provider settings struct
6781
typedef struct umf_os_memory_provider_params_t {
6882
/// Combination of 'umf_mem_protection_flags_t' flags
@@ -83,6 +97,11 @@ typedef struct umf_os_memory_provider_params_t {
8397
/// part size for interleave mode - 0 means default (system specific)
8498
/// It might be rounded up because of HW constraints
8599
size_t part_size;
100+
101+
/// ordered list of the partitions for the split mode
102+
umf_numa_split_partition_t *partitions;
103+
/// len of the partitions array
104+
unsigned partitions_len;
86105
} umf_os_memory_provider_params_t;
87106

88107
/// @brief OS Memory Provider operation results
@@ -109,8 +128,9 @@ umfOsMemoryProviderParamsDefault(void) {
109128
NULL, /* numa_list */
110129
0, /* numa_list_len */
111130
UMF_NUMA_MODE_DEFAULT, /* numa_mode */
112-
0 /* part_size */
113-
};
131+
0, /* part_size */
132+
NULL, /* partitions */
133+
0}; /* partitions_len*/
114134

115135
return params;
116136
}

0 commit comments

Comments
 (0)