diff --git a/executer/include/uprotocol.h b/executer/include/uprotocol.h index 7debda29..dec38125 100644 --- a/executer/include/uprotocol.h +++ b/executer/include/uprotocol.h @@ -164,6 +164,7 @@ struct program_load_desc { (sizeof(unsigned long) * 8)]; int thp_disable; + int enable_uti; int uti_thread_rank; /* N-th clone() spawns a thread on Linux CPU */ int uti_use_last_cpu; /* Work-around not to share CPU with OpenMP thread */ int straight_map; diff --git a/executer/user/mcexec.c b/executer/user/mcexec.c index aae25353..b807d236 100644 --- a/executer/user/mcexec.c +++ b/executer/user/mcexec.c @@ -2816,6 +2816,7 @@ int main(int argc, char **argv) desc->mpol_mode, desc->mpol_nodemask[0]); } + desc->enable_uti = enable_uti; desc->uti_thread_rank = uti_thread_rank; desc->uti_use_last_cpu = uti_use_last_cpu; desc->thp_disable = get_thp_disable(); diff --git a/kernel/host.c b/kernel/host.c index 05766ad9..93d794c7 100644 --- a/kernel/host.c +++ b/kernel/host.c @@ -563,6 +563,7 @@ static int process_msg_prepare_process(unsigned long rphys) __func__, vm->numa_mem_policy, vm->numa_mask[0]); } + proc->enable_uti = pn->enable_uti; proc->uti_thread_rank = pn->uti_thread_rank; proc->uti_use_last_cpu = pn->uti_use_last_cpu; diff --git a/kernel/include/process.h b/kernel/include/process.h index 000da5b9..89b76e2c 100644 --- a/kernel/include/process.h +++ b/kernel/include/process.h @@ -565,6 +565,7 @@ struct process { unsigned long mpol_bind_mask; int mpol_mode; + int enable_uti; int uti_thread_rank; /* Spawn on Linux CPU when clone_count reaches this */ int uti_use_last_cpu; /* Work-around not to share CPU with OpenMP thread */ int clone_count; diff --git a/kernel/include/syscall.h b/kernel/include/syscall.h index aabd4386..abb57321 100644 --- a/kernel/include/syscall.h +++ b/kernel/include/syscall.h @@ -235,6 +235,7 @@ struct program_load_desc { (sizeof(unsigned long) * 8)]; int thp_disable; + int enable_uti; int uti_thread_rank; /* N-th clone() spawns a thread on Linux CPU */ int uti_use_last_cpu; /* Work-around not to share CPU with OpenMP thread */ int straight_map; diff --git a/kernel/process.c b/kernel/process.c index fbde6c71..82df0e3c 100644 --- a/kernel/process.c +++ b/kernel/process.c @@ -122,6 +122,7 @@ init_process(struct process *proc, struct process *parent) sizeof(struct rlimit) * MCK_RLIM_MAX); memcpy(&proc->cpu_set, &parent->cpu_set, sizeof(proc->cpu_set)); + proc->enable_uti = parent->enable_uti; } INIT_LIST_HEAD(&proc->hash_list); diff --git a/kernel/syscall.c b/kernel/syscall.c index 5ebb71d2..15aee08a 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -10722,6 +10722,12 @@ SYSCALL_DECLARE(util_indicate_clone) struct thread *thread = cpu_local_var(current); struct uti_attr *kattr = NULL; + if (!thread->proc->enable_uti) { + kprintf("%s: error: --enable-uti mcexec option not specified\n", + __func__); + return -EINVAL; + } + if (mod != SPAWN_TO_LOCAL && mod != SPAWN_TO_REMOTE) return -EINVAL;