diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index eec6da7a2bf52d8906e5bf083a55430e956a3ad3..1e2a79da89d8aecbe8f6d01b4a6b6c91b4b4093b 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -904,8 +904,30 @@ static inline int determine_next_mode_pb(struct rq *rq) * Is the tick interrupt active in this moment? */ if(pb->count_admin_cycles > pb->n_admin_cycles){ - mode = PB_EXEC_MODE; - pb->count_admin_cycles = 0; + /* + * If the current plan_entry's process is blocked, we cannot + * go in PB_EXEC_MODE. The reason could be, that administrative + * tasks were pushed forward by the default scheduler and the IO + * starved. We have to wait until the process is runnable. + */ + if (pb->plan[pb->c_entry].task_struct->state >= 0) { + /* + * 0 == Runnable (IO succeeded) + * >0 == stopped (Process finished) + */ + mode = PB_EXEC_MODE; + pb->count_admin_cycles = 0; + + } else { + /* + * -1 == unrunnable + */ + mode = PB_ADMIN_MODE; + printk(KERN_WARNING "PB TASK %llu BLOCKED BY IO FOR %llu TOO MANY TICKS\n", + pb->plan[pb->c_entry].task_id, + pb->count_admin_cycles - pb->n_admin_cycles); + } + }else{ mode = PB_ADMIN_MODE; }