Skip to content

Commit 24f3824

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 24f3824

File tree

4 files changed

+470
-36
lines changed

4 files changed

+470
-36
lines changed

include/umf/providers/provider_os_memory.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,23 @@ 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+
/// An extra argument could be passed in params structure 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+
/// @brief partition specification for UMF_NUMA_MODE_SPLIT
70+
typedef struct umf_numa_split_partition_t {
71+
/// weight of partition.
72+
unsigned weight;
73+
/// numa node
74+
unsigned target;
75+
} umf_numa_split_partition_t;
76+
6677
/// @brief Memory provider settings struct
6778
typedef struct umf_os_memory_provider_params_t {
6879
/// Combination of 'umf_mem_protection_flags_t' flags
@@ -81,6 +92,11 @@ typedef struct umf_os_memory_provider_params_t {
8192
/// part size for interleave mode - 0 means default (system specific)
8293
/// It might be rounded up because of HW constraints
8394
size_t part_size;
95+
96+
/// ordered list of the partitions for split mode
97+
umf_numa_split_partition_t *partitions;
98+
/// len of partitions array
99+
unsigned partitions_len;
84100
} umf_os_memory_provider_params_t;
85101

86102
/// @brief OS Memory Provider operation results
@@ -106,8 +122,9 @@ umfOsMemoryProviderParamsDefault(void) {
106122
NULL, /* numa_list */
107123
0, /* numa_list_len */
108124
UMF_NUMA_MODE_DEFAULT, /* numa_mode */
109-
0 /* part_size */
110-
};
125+
0, /* part_size */
126+
NULL, /* partitions */
127+
0}; /* partitions_len*/
111128

112129
return params;
113130
}

0 commit comments

Comments
 (0)