Skip to content

Commit 792ace0

Browse files
committed
add umf split mode to os_memory_provider
split mode splits each allocation based on user provided partitions, across multiple numa nodes. If no partition defined then each allocation is split evenly, across all numa available. Signed-off-by: Łukasz Plewa <[email protected]>
1 parent 40d5329 commit 792ace0

File tree

4 files changed

+471
-37
lines changed

4 files changed

+471
-37
lines changed

include/umf/providers/provider_os_memory.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,21 @@ 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 splited evenly across nodes specified in nodemask.
61+
/// an extra argument could be passed to specify other distribution.
62+
UMF_NUMA_MODE_SPLIT,
6063
/// The memory is allocated on the node of the CPU that triggered the
6164
/// allocation. If this mode is specified, nodemask must be NULL and
6265
/// maxnode must be 0.
6366
UMF_NUMA_MODE_LOCAL, // TODO: should this be a hint or strict policy?
6467
} umf_numa_mode_t;
6568

69+
///
70+
typedef struct umf_numa_split_partition_t {
71+
unsigned weight;
72+
unsigned target;
73+
} umf_numa_split_partition_t;
74+
6675
/// @brief Memory provider settings struct
6776
typedef struct umf_os_memory_provider_params_t {
6877
/// Combination of 'umf_mem_protection_flags_t' flags
@@ -81,6 +90,9 @@ typedef struct umf_os_memory_provider_params_t {
8190
/// part size for interleave mode - 0 means default (system specific)
8291
/// It might be rounded up because of HW constraints
8392
size_t part_size;
93+
94+
umf_numa_split_partition_t *partitions;
95+
int partitions_len;
8496
} umf_os_memory_provider_params_t;
8597

8698
/// @brief OS Memory Provider operation results
@@ -106,8 +118,9 @@ umfOsMemoryProviderParamsDefault(void) {
106118
NULL, /* numa_list */
107119
0, /* numa_list_len */
108120
UMF_NUMA_MODE_DEFAULT, /* numa_mode */
109-
0 /* part_size */
110-
};
121+
0, /* part_size */
122+
NULL, /* partitions */
123+
0}; /* partitions_len*/
111124

112125
return params;
113126
}

0 commit comments

Comments
 (0)