From 1070387ed20ae111eace9824b742c48a6c4d3200 Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Wed, 3 Mar 2021 14:45:13 +0900 Subject: [PATCH] SCD_MSG_SCHEDULE_PROCESS: stay on current CPU if set in process' CPU mask Change-Id: I347fe61f8123792648747ec9bf856a9340ea9d9b --- executer/user/mcexec.c | 2 +- kernel/host.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/executer/user/mcexec.c b/executer/user/mcexec.c index 9c78e2a6..acae1f8b 100644 --- a/executer/user/mcexec.c +++ b/executer/user/mcexec.c @@ -2646,7 +2646,7 @@ int main(int argc, char **argv) } /* Partitioned execution, obtain CPU set */ - if (nr_processes > 0) { + if (!target_core && nr_processes > 0) { struct get_cpu_set_arg cpu_set_arg; int mcexec_linux_numa = 0; int ikc_mapped = 0; diff --git a/kernel/host.c b/kernel/host.c index 7241307e..521f3fdd 100644 --- a/kernel/host.c +++ b/kernel/host.c @@ -758,11 +758,14 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c, case SCD_MSG_SCHEDULE_PROCESS: thread = (struct thread *)packet->arg; - cpuid = obtain_clone_cpuid(&thread->cpu_set, 0); - if (cpuid == -1) { - kprintf("No CPU available\n"); - ret = -1; - break; + cpuid = ihk_mc_get_processor_id(); + if (!CPU_ISSET(cpuid, &thread->cpu_set)) { + cpuid = obtain_clone_cpuid(&thread->cpu_set, 0); + if (cpuid == -1) { + kprintf("No CPU available\n"); + ret = -1; + break; + } } dkprintf("SCD_MSG_SCHEDULE_PROCESS: %lx\n", packet->arg);