/* litmus/jobs.c - common job control code */ #include #include #include void prepare_for_next_period(struct task_struct *t) { BUG_ON(!t); #ifdef CONFIG_PLUGIN_COLOR tsk_rt(t)->tot_exec_time += tsk_rt(t)->job_params.exec_time; #endif /* prepare next release */ tsk_rt(t)->job_params.release = tsk_rt(t)->job_params.deadline; tsk_rt(t)->job_params.deadline += get_rt_period(t); tsk_rt(t)->job_params.exec_time = 0; /* update job sequence number */ tsk_rt(t)->job_params.job_no++; /* don't confuse Linux */ t->rt.time_slice = 1; } void release_at(struct task_struct *t, lt_t start) { tsk_rt(t)->job_params.deadline = start; prepare_for_next_period(t); set_rt_flags(t, RT_F_RUNNING); } /* * Deactivate current task until the beginning of the next period. */ long complete_job(void) { /* Mark that we do not excute anymore */ set_rt_flags(current, RT_F_SLEEP); /* call schedule, this will return when a new job arrives * it also takes care of preparing for the next release */ schedule(); return 0; }