mcexec: -m: interpret as numactl -m (i.e., MPOL_BIND)
Conflicts: executer/include/uprotocol.h executer/user/mcexec.c kernel/include/syscall.h
This commit is contained in:
@@ -141,6 +141,7 @@ struct program_load_desc {
|
|||||||
unsigned long mpol_threshold;
|
unsigned long mpol_threshold;
|
||||||
unsigned long heap_extension;
|
unsigned long heap_extension;
|
||||||
long stack_premap;
|
long stack_premap;
|
||||||
|
unsigned long mpol_bind_mask;
|
||||||
int nr_processes;
|
int nr_processes;
|
||||||
char shell_path[SHELL_PATH_MAX_LEN];
|
char shell_path[SHELL_PATH_MAX_LEN];
|
||||||
__cpu_set_unit cpu_set[PLD_CPU_SET_SIZE];
|
__cpu_set_unit cpu_set[PLD_CPU_SET_SIZE];
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ static int disable_sched_yield = 0;
|
|||||||
static long stack_premap = (2ULL << 20);
|
static long stack_premap = (2ULL << 20);
|
||||||
static long stack_max = -1;
|
static long stack_max = -1;
|
||||||
static struct rlimit rlim_stack;
|
static struct rlimit rlim_stack;
|
||||||
|
static char *mpol_bind_nodes = NULL;
|
||||||
|
|
||||||
/* Partitioned execution (e.g., for MPI) */
|
/* Partitioned execution (e.g., for MPI) */
|
||||||
static int nr_processes = 0;
|
static int nr_processes = 0;
|
||||||
@@ -1869,9 +1870,9 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* Parse options ("+" denotes stop at the first non-option) */
|
/* Parse options ("+" denotes stop at the first non-option) */
|
||||||
#ifdef ADD_ENVS_OPTION
|
#ifdef ADD_ENVS_OPTION
|
||||||
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:e:s:", mcexec_options, NULL)) != -1) {
|
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:e:s:m:", mcexec_options, NULL)) != -1) {
|
||||||
#else /* ADD_ENVS_OPTION */
|
#else /* ADD_ENVS_OPTION */
|
||||||
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:s:", mcexec_options, NULL)) != -1) {
|
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:s:m:", mcexec_options, NULL)) != -1) {
|
||||||
#endif /* ADD_ENVS_OPTION */
|
#endif /* ADD_ENVS_OPTION */
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
char *tmp;
|
char *tmp;
|
||||||
@@ -1904,6 +1905,10 @@ int main(int argc, char **argv)
|
|||||||
mpol_threshold = atobytes(optarg);
|
mpol_threshold = atobytes(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'm':
|
||||||
|
mpol_bind_nodes = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
heap_extension = atobytes(optarg);
|
heap_extension = atobytes(optarg);
|
||||||
break;
|
break;
|
||||||
@@ -2388,6 +2393,21 @@ int main(int argc, char **argv)
|
|||||||
desc->mpol_threshold = mpol_threshold;
|
desc->mpol_threshold = mpol_threshold;
|
||||||
desc->heap_extension = heap_extension;
|
desc->heap_extension = heap_extension;
|
||||||
|
|
||||||
|
desc->mpol_bind_mask = 0;
|
||||||
|
if (mpol_bind_nodes) {
|
||||||
|
struct bitmask *bind_mask;
|
||||||
|
bind_mask = numa_parse_nodestring_all(mpol_bind_nodes);
|
||||||
|
|
||||||
|
if (bind_mask) {
|
||||||
|
int node;
|
||||||
|
for (node = 0; node <= numa_max_possible_node(); ++node) {
|
||||||
|
if (numa_bitmask_isbitset(bind_mask, node)) {
|
||||||
|
desc->mpol_bind_mask |= (1UL << node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ioctl(fd, MCEXEC_UP_PREPARE_IMAGE, (unsigned long)desc) != 0) {
|
if (ioctl(fd, MCEXEC_UP_PREPARE_IMAGE, (unsigned long)desc) != 0) {
|
||||||
perror("prepare");
|
perror("prepare");
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|||||||
@@ -476,6 +476,27 @@ static int process_msg_prepare_process(unsigned long rphys)
|
|||||||
proc->mpol_threshold = pn->mpol_threshold;
|
proc->mpol_threshold = pn->mpol_threshold;
|
||||||
proc->nr_processes = pn->nr_processes;
|
proc->nr_processes = pn->nr_processes;
|
||||||
proc->heap_extension = pn->heap_extension;
|
proc->heap_extension = pn->heap_extension;
|
||||||
|
|
||||||
|
/* Update NUMA binding policy if requested */
|
||||||
|
if (pn->mpol_bind_mask) {
|
||||||
|
int bit;
|
||||||
|
|
||||||
|
memset(&vm->numa_mask, 0, sizeof(vm->numa_mask));
|
||||||
|
|
||||||
|
for_each_set_bit(bit, &pn->mpol_bind_mask,
|
||||||
|
sizeof(pn->mpol_bind_mask) * BITS_PER_BYTE) {
|
||||||
|
|
||||||
|
if (bit >= ihk_mc_get_nr_numa_nodes()) {
|
||||||
|
kprintf("%s: error: NUMA id %d is larger than mask size!\n",
|
||||||
|
__FUNCTION__, bit);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_bit(bit, &vm->numa_mask[0]);
|
||||||
|
}
|
||||||
|
vm->numa_mem_policy = MPOL_BIND;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef PROFILE_ENABLE
|
#ifdef PROFILE_ENABLE
|
||||||
proc->profile = pn->profile;
|
proc->profile = pn->profile;
|
||||||
thread->profile = pn->profile;
|
thread->profile = pn->profile;
|
||||||
|
|||||||
@@ -553,6 +553,7 @@ struct process {
|
|||||||
unsigned long mpol_flags;
|
unsigned long mpol_flags;
|
||||||
size_t mpol_threshold;
|
size_t mpol_threshold;
|
||||||
unsigned long heap_extension;
|
unsigned long heap_extension;
|
||||||
|
unsigned long mpol_bind_mask;
|
||||||
|
|
||||||
// perf_event
|
// perf_event
|
||||||
int perf_status;
|
int perf_status;
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ struct program_load_desc {
|
|||||||
unsigned long mpol_threshold;
|
unsigned long mpol_threshold;
|
||||||
unsigned long heap_extension;
|
unsigned long heap_extension;
|
||||||
long stack_premap;
|
long stack_premap;
|
||||||
|
unsigned long mpol_bind_mask;
|
||||||
int nr_processes;
|
int nr_processes;
|
||||||
char shell_path[SHELL_PATH_MAX_LEN];
|
char shell_path[SHELL_PATH_MAX_LEN];
|
||||||
__cpu_set_unit cpu_set[PLD_CPU_SET_SIZE];
|
__cpu_set_unit cpu_set[PLD_CPU_SET_SIZE];
|
||||||
|
|||||||
Reference in New Issue
Block a user