uti: Identify uti thread by clone count
--uti-thread-count <count> is added to mcexec. Change-Id: Id9ec464412a5bb71e4d9e87d05f79de22d35b067
This commit is contained in:
@@ -505,6 +505,8 @@ static int process_msg_prepare_process(unsigned long rphys)
|
||||
vm->numa_mem_policy = MPOL_BIND;
|
||||
}
|
||||
|
||||
proc->uti_thread_rank = pn->uti_thread_rank;
|
||||
|
||||
#ifdef PROFILE_ENABLE
|
||||
proc->profile = pn->profile;
|
||||
thread->profile = pn->profile;
|
||||
|
||||
@@ -556,6 +556,8 @@ struct process {
|
||||
size_t mpol_threshold;
|
||||
unsigned long heap_extension;
|
||||
unsigned long mpol_bind_mask;
|
||||
int uti_thread_rank; /* Spawn on Linux CPU when clone_count reaches this */
|
||||
int clone_count;
|
||||
|
||||
// perf_event
|
||||
int perf_status;
|
||||
|
||||
@@ -200,6 +200,7 @@ struct program_load_desc {
|
||||
unsigned long heap_extension;
|
||||
long stack_premap;
|
||||
unsigned long mpol_bind_mask;
|
||||
int uti_thread_rank; /* N-th clone() spawns a thread on Linux CPU */
|
||||
int nr_processes;
|
||||
int process_rank;
|
||||
char shell_path[SHELL_PATH_MAX_LEN];
|
||||
|
||||
@@ -3455,6 +3455,8 @@ void runq_add_thread(struct thread *thread, int cpu_id)
|
||||
|
||||
procfs_create_thread(thread);
|
||||
|
||||
__sync_add_and_fetch(&thread->proc->clone_count, 1);
|
||||
dkprintf("%s: clone_count is %d\n", __FUNCTION__, thread->proc->clone_count);
|
||||
rusage_num_threads_inc();
|
||||
#ifdef RUSAGE_DEBUG
|
||||
if (rusage->num_threads == 1) {
|
||||
|
||||
@@ -2451,6 +2451,18 @@ unsigned long do_fork(int clone_flags, unsigned long newsp,
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
/* N-th creation put the new on Linux CPU. It's turned off when zero is
|
||||
set to uti_thread_rank. */
|
||||
if (oldproc->uti_thread_rank) {
|
||||
if (oldproc->clone_count + 1 == oldproc->uti_thread_rank) {
|
||||
old->mod_clone = SPAWN_TO_REMOTE;
|
||||
kprintf("%s: mod_clone is set to %d\n", __FUNCTION__, old->mod_clone);
|
||||
} else {
|
||||
old->mod_clone = SPAWN_TO_LOCAL;
|
||||
kprintf("%s: mod_clone is set to %d\n", __FUNCTION__, old->mod_clone);
|
||||
}
|
||||
}
|
||||
|
||||
new = clone_thread(old, curpc,
|
||||
newsp ? newsp : cursp, clone_flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user