diff --git a/kernel/sched/pb.c b/kernel/sched/pb.c index 761266d3e11ba8388e32c97384e1ff7ea2503aae..f124823b3bedd7db6fd5a0daea147077404ebc84 100644 --- a/kernel/sched/pb.c +++ b/kernel/sched/pb.c @@ -246,49 +246,4 @@ const struct sched_class pb_sched_class = { }; EXPORT_SYMBOL(pb_sched_class); -// used to determine the next mode of the PB-Scheduler -// This function is located in sched.h since pb.c and fair.c are using this function -inline int determine_next_mode_pb(struct rq *rq) -{ - int mode = PB_DISABLED_MODE; - struct pb_rq *pb = &(rq->pb); - if (pb->c_entry < pb->size) - { - // initial switch - if (pb->mode == PB_DISABLED_MODE && pb->is_initialized) - { - return PB_EXEC_MODE; - } - else - { - if (pb->mode == PB_EXEC_MODE) - { - //stay for n timer interrupts cycles in exec mode - /* - * Is the tick interrupt active in this moment? - */ - if(pb->count_pb_cycles > pb->n_pb_cycles){ - mode = PB_ADMIN_MODE; - pb->count_pb_cycles = 0; - }else{ - mode = PB_EXEC_MODE; - } - } - else if (pb->mode == PB_ADMIN_MODE) - { - //stay for n timer interrupt cylces in uall mode for admin tasks - /* - * 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; - }else{ - mode = PB_ADMIN_MODE; - } - } - } - } - return mode; -} diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 16eeea7788f9dc93255037ddac974e0c981905ba..7c60deb1a910ce7c63c7f1d13d4ee875f36ea56a 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -551,7 +551,52 @@ struct pb_rq { }; int pb_init_rq(struct pb_init_struct *initstr, struct rq *rq); -inline int determine_next_mode_pb(struct rq *rq); +// used to determine the next mode of the PB-Scheduler +// This function is located in sched.h since pb.c and fair.c are using this function +static inline int determine_next_mode_pb(struct rq *rq) +{ + int mode = PB_DISABLED_MODE; + struct pb_rq *pb = &(rq->pb); + + if (pb->c_entry < pb->size) + { + // initial switch + if (pb->mode == PB_DISABLED_MODE && pb->is_initialized) + { + return PB_EXEC_MODE; + } + else + { + if (pb->mode == PB_EXEC_MODE) + { + //stay for n timer interrupts cycles in exec mode + /* + * Is the tick interrupt active in this moment? + */ + if(pb->count_pb_cycles > pb->n_pb_cycles){ + mode = PB_ADMIN_MODE; + pb->count_pb_cycles = 0; + }else{ + mode = PB_EXEC_MODE; + } + } + else if (pb->mode == PB_ADMIN_MODE) + { + //stay for n timer interrupt cylces in uall mode for admin tasks + /* + * 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; + }else{ + mode = PB_ADMIN_MODE; + } + } + } + } + return mode; +} static inline int rt_bandwidth_enabled(void) {