partitioned execution: pass process rank to LWK

Cherry-pick of d2d134d5e6a4b16a34d55d31b14614a2a91ecf47

Conflicts:
	kernel/include/process.h
This commit is contained in:
Balazs Gerofi
2017-08-23 10:16:22 +09:00
committed by Masamichi Takagi
parent 4439b04d9f
commit a697f5e98d
7 changed files with 20 additions and 0 deletions

View File

@ -91,6 +91,7 @@ struct program_image_section {
struct get_cpu_set_arg {
int nr_processes;
int *process_rank;
void *cpu_set;
size_t cpu_set_size; // Size in bytes
int *target_core;
@ -141,6 +142,7 @@ struct program_load_desc {
long stack_premap;
unsigned long mpol_bind_mask;
int nr_processes;
int process_rank;
char shell_path[SHELL_PATH_MAX_LEN];
__cpu_set_unit cpu_set[PLD_CPU_SET_SIZE];
int profile;

View File

@ -654,6 +654,7 @@ static long mcexec_get_cpuset(ihk_os_t os, unsigned long arg)
wake_up_interruptible(&pli_next->pli_wq);
/* Reset process counter */
pe->nr_processes_left = pe->nr_processes;
pe->process_rank = 0;
}
/* Wait for the rest if not the last or if the last but
@ -885,6 +886,15 @@ next_cpu:
goto put_and_unlock_out;
}
/* Copy rank */
if (copy_to_user(req.process_rank, &pe->process_rank,
sizeof(int))) {
printk("%s: error copying process rank to user\n",
__FUNCTION__);
ret = -EINVAL;
goto put_and_unlock_out;
}
/* mcexec NUMA to bind to */
mcexec_linux_numa = cpu_to_node(mckernel_cpu_2_linux_cpu(udp, cpu));
if (copy_to_user(req.mcexec_linux_numa, &mcexec_linux_numa,
@ -932,6 +942,7 @@ next_cpu:
}
/* Otherwise wake up next process in list */
else {
++pe->process_rank;
pli_next = list_first_entry(&pe->pli_list,
struct process_list_item, list);
list_del(&pli_next->list);

View File

@ -316,6 +316,7 @@ struct mcctrl_part_exec {
struct mutex lock;
int nr_processes;
int nr_processes_left;
int process_rank;
cpumask_t cpus_used;
struct list_head pli_list;
};

View File

@ -2456,6 +2456,7 @@ int main(int argc, char **argv)
struct get_cpu_set_arg cpu_set_arg;
int mcexec_linux_numa = 0;
int ikc_mapped = 0;
int process_rank = -1;
cpu_set_t mcexec_cpu_set;
CPU_ZERO(&mcexec_cpu_set);
@ -2464,6 +2465,7 @@ int main(int argc, char **argv)
cpu_set_arg.cpu_set_size = sizeof(desc->cpu_set);
cpu_set_arg.nr_processes = nr_processes;
cpu_set_arg.target_core = &target_core;
cpu_set_arg.process_rank = &process_rank;
cpu_set_arg.mcexec_linux_numa = &mcexec_linux_numa;
cpu_set_arg.mcexec_cpu_set = &mcexec_cpu_set;
cpu_set_arg.mcexec_cpu_set_size = sizeof(mcexec_cpu_set);
@ -2476,6 +2478,7 @@ int main(int argc, char **argv)
}
desc->cpu = target_core;
desc->process_rank = process_rank;
/* Bind to CPU cores where the LWK process' IKC target maps to */
if (ikc_mapped && !no_bind_ikc_map) {

View File

@ -482,6 +482,7 @@ static int process_msg_prepare_process(unsigned long rphys)
proc->mpol_flags = pn->mpol_flags;
proc->mpol_threshold = pn->mpol_threshold;
proc->nr_processes = pn->nr_processes;
proc->process_rank = pn->process_rank;
proc->heap_extension = pn->heap_extension;
/* Update NUMA binding policy if requested */

View File

@ -570,6 +570,7 @@ struct process {
unsigned long profile_elapsed_ts;
#endif // PROFILE_ENABLE
int nr_processes; /* For partitioned execution */
int process_rank; /* Rank in partition */
};
/*

View File

@ -199,6 +199,7 @@ struct program_load_desc {
long stack_premap;
unsigned long mpol_bind_mask;
int nr_processes;
int process_rank;
char shell_path[SHELL_PATH_MAX_LEN];
__cpu_set_unit cpu_set[PLD_CPU_SET_SIZE];
int profile;