Skip to content
Snippets Groups Projects
Commit 94cd0420 authored by FKHals's avatar FKHals
Browse files

Distinguish syscalls in pb-scheduler

to prepare for using the pbm-model as the scheduling policy.
parent 6735145f
Branches
No related tags found
No related merge requests found
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
#include "behave.h" #include "behave.h"
#include "sched/sched.h"
static void __unhash_process(struct task_struct *p, bool group_dead) static void __unhash_process(struct task_struct *p, bool group_dead)
{ {
...@@ -767,6 +768,15 @@ void __noreturn do_exit(long code) ...@@ -767,6 +768,15 @@ void __noreturn do_exit(long code)
struct task_struct *tsk = current; struct task_struct *tsk = current;
int group_dead; int group_dead;
struct rq* rq;
rq = this_rq();
// prevent syscalls from outside of the measured program (e.g. admin tasks) to be recognized
if (PB_EXEC_MODE == rq->pb.mode) {
// set flag so that the pb-scheduler knows which syscall triggered the scheduling
rq->pb.triggering_syscall = sched_trig_EXIT;
}
// call the readout before the process is terminated // call the readout before the process is terminated
if (is_relevant_process(tsk)) { if (is_relevant_process(tsk)) {
pbm_exit(tsk->pid, tsk->real_parent->pid); pbm_exit(tsk->pid, tsk->real_parent->pid);
......
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
#include <trace/events/task.h> #include <trace/events/task.h>
#include "behave.h" #include "behave.h"
#include "sched/sched.h"
/* /*
* Minimum number of threads to boot the kernel * Minimum number of threads to boot the kernel
...@@ -2016,10 +2017,19 @@ long _do_fork(unsigned long clone_flags, ...@@ -2016,10 +2017,19 @@ long _do_fork(unsigned long clone_flags,
int trace = 0; int trace = 0;
long nr; long nr;
struct rq* rq;
pbm_NODE* fork_date; pbm_NODE* fork_date;
pid_t parent_pid = current->pid; pid_t parent_pid = current->pid;
fork_date = NULL; fork_date = NULL;
rq = this_rq();
// prevent syscalls from outside of the measured program (e.g. admin tasks) to be recognized
if (PB_EXEC_MODE == rq->pb.mode) {
// set flag so that the pb-scheduler knows which syscall triggered the scheduling
rq->pb.triggering_syscall = sched_trig_FORK;
}
// FIXME: This will not get called for mpirun since then bash will be the parent here // FIXME: This will not get called for mpirun since then bash will be the parent here
if (is_relevant_process(current)) { if (is_relevant_process(current)) {
printk(KERN_EMERG "DO FORK CALLED by: '%s' %u\n", current->comm ,parent_pid); printk(KERN_EMERG "DO FORK CALLED by: '%s' %u\n", current->comm ,parent_pid);
......
...@@ -283,6 +283,22 @@ static struct task_struct * pick_next_task_pb(struct rq *rq, ...@@ -283,6 +283,22 @@ static struct task_struct * pick_next_task_pb(struct rq *rq,
// EXEC Mode is next, so we return our next task to be executed // EXEC Mode is next, so we return our next task to be executed
if (next_mode == PB_EXEC_MODE) { if (next_mode == PB_EXEC_MODE) {
switch(pb->triggering_syscall) {
case sched_trig_FORK:
printk(KERN_WARNING "FORK TRIGGERED THIS!!!\n");
break;
case sched_trig_EXIT:
printk(KERN_WARNING "EXIT TRIGGERED THIS!!!\n");
break;
default:
printk(KERN_WARNING "OTHER STUFF TRIGGERED THIS!!!\n");
break;
}
// reset the flag so that the relevant syscalls can be detected if they are the trigger
pb->triggering_syscall = sched_trig_OTHER;
// printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__); // printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
if(current_mode == PB_ADMIN_MODE) { if(current_mode == PB_ADMIN_MODE) {
printk(KERN_DEBUG "PB ADMIN,STOP,%u,%llu\n", pb->c_entry, sched_clock()); printk(KERN_DEBUG "PB ADMIN,STOP,%u,%llu\n", pb->c_entry, sched_clock());
......
...@@ -546,6 +546,8 @@ struct pb_plan { ...@@ -546,6 +546,8 @@ struct pb_plan {
size_t num_tasks; // number of tasks in the plan size_t num_tasks; // number of tasks in the plan
}; };
enum sched_trigger_syscall { sched_trig_FORK, sched_trig_EXIT, sched_trig_OTHER };
struct pb_rq struct pb_rq
{ {
struct plan_entry *plan; // plan (used to be proxy_task) struct plan_entry *plan; // plan (used to be proxy_task)
...@@ -563,6 +565,7 @@ struct pb_rq ...@@ -563,6 +565,7 @@ struct pb_rq
u64 total_instr; // total counted instructions for current plan u64 total_instr; // total counted instructions for current plan
struct perf_event *pevent; // linux perf handle struct perf_event *pevent; // linux perf handle
enum sched_trigger_syscall triggering_syscall; // which syscall triggered the scheduler
/* /*
* flag determining whether the plan is completely initialized and should be run * flag determining whether the plan is completely initialized and should be run
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment