diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 8f6493bbf28affaa6b55abc2e2c1a12f3440680d..e77b9ce792fa836889dd166039ef402e36f01067 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6195,7 +6195,7 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf current_mode = rq->pb.mode; next_mode = determine_next_mode_pb(now, rq); - if ((current_mode == PB_DISABLED_MODE || current_mode == PB_FREE_MODE) && next_mode == PB_EXEC_MODE) + if ((current_mode == PB_DISABLED_MODE || current_mode == PB_UALL_MODE) && next_mode == PB_EXEC_MODE) { return RETRY_TASK; } diff --git a/kernel/sched/pb.c b/kernel/sched/pb.c index 18ecc8092c87e2d3885e56054a632675f9839108..9895aafbbe962ddeef48d022c8432c5d4c59092b 100644 --- a/kernel/sched/pb.c +++ b/kernel/sched/pb.c @@ -39,17 +39,17 @@ void set_pb_plan_size(struct pb_rq *pb_rq, unsigned int size) } EXPORT_SYMBOL(set_pb_plan_size); -void set_pb_plan_entry(struct pb_rq *pb_rq, unsigned int i, u64 exec_time, u64 free_time) +void set_pb_plan_entry(struct pb_rq *pb_rq, unsigned int i, u64 exec_time, u64 uall_time) { pb_rq->plan[i].exec_time = exec_time; - pb_rq->plan[i].free_time = free_time; + pb_rq->plan[i].uall_time = uall_time; } EXPORT_SYMBOL(set_pb_plan_entry); // called by core.c sched_init void init_pb_rq(struct pb_rq *pb_rq) { - pb_rq->free_until = 0; + pb_rq->uall_until = 0; pb_rq->exec_until = 0; pb_rq->mode = PB_DISABLED_MODE; pb_rq->c_entry = 0; @@ -108,33 +108,33 @@ static struct task_struct * pick_next_task_pb(struct rq *rq, // continue executing the task in PB_EXEC_MODE if (current_mode == PB_EXEC_MODE) picked = pb->proxy_task; - // in case of PB_FREE_MODE/PB_DISABLED_MODE picked == NULL + // in case of PB_UALL_MODE/PB_DISABLED_MODE picked == NULL } // Mode change --> behavior changes else { // Matches: // switch from PB_DISABLE_MODE to PB_EXEC_MODE or - // switch from PB_FREE_MODE to PB_EXEC_MODE + // switch from PB_UALL_MODE to PB_EXEC_MODE if ((current_mode == PB_DISABLED_MODE || - current_mode == PB_FREE_MODE) + current_mode == PB_UALL_MODE) && next_mode == PB_EXEC_MODE) { pb->mode = next_mode; - pb->free_until = 0; + pb->uall_until = 0; pb->exec_until = pb->plan[pb->c_entry].exec_time + now; picked = pb->proxy_task; - if (current_mode == PB_FREE_MODE) + if (current_mode == PB_UALL_MODE) printk(KERN_DEBUG "IDLE,STOP,%u,%llu\n", pb->c_entry, now); printk(KERN_DEBUG "EXEC,START,%u,%llu\n", pb->c_entry, now); } - // Matches the switch from PB_EXEC_MODE to PB_FREE_MODE + // Matches the switch from PB_EXEC_MODE to PB_UALL_MODE else if (current_mode == PB_EXEC_MODE && - next_mode == PB_FREE_MODE) + next_mode == PB_UALL_MODE) { pb->mode = next_mode; - pb->free_until = pb->plan[pb->c_entry].free_time + now; + pb->uall_until = pb->plan[pb->c_entry].uall_time + now; pb->exec_until = 0; printk(KERN_DEBUG "EXEC,STOP,%u,%llu\n", pb->c_entry, now); @@ -151,7 +151,7 @@ static struct task_struct * pick_next_task_pb(struct rq *rq, } else { - printk(KERN_DEBUG "IDLE,START,%u,%llu\n", pb->c_entry, now); + printk(KERN_DEBUG "UALL,START,%u,%llu\n", pb->c_entry, now); } } @@ -183,7 +183,7 @@ static void task_tick_pb(struct rq *rq, struct task_struct *p, int queued) current_mode = rq->pb.mode; next_mode = determine_next_mode_pb(now, rq); - if (current_mode == PB_EXEC_MODE && next_mode == PB_FREE_MODE) + if (current_mode == PB_EXEC_MODE && next_mode == PB_UALL_MODE) { resched_curr(rq); } diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 9476067800f3fbe3ee5d032d128227c3a4c6d290..2f016817b9aeda5c0245524e52f1a5b11416080d 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -46,7 +46,7 @@ #define PB_DISABLED_MODE 0 #define PB_EXEC_MODE 1 -#define PB_FREE_MODE 2 +#define PB_UALL_MODE 2 #define PB_MEASURE_K_OFF 0 #define PB_MEASURE_K_ON 1 @@ -523,7 +523,7 @@ struct plan_entry { // the amount of time the task should be executed u64 exec_time; // the amount of time other scheduler modules are used after the task is executed - u64 free_time; + u64 uall_time; }; struct pb_rq { @@ -534,11 +534,11 @@ struct pb_rq { unsigned int c_entry; // pointer to the dummy task struct task_struct *proxy_task; - // absolute times, which are result of current_time + exec_time or current_time + free_time - u64 free_until; + // absolute times, which are result of current_time + exec_time or current_time + uall_time + u64 uall_until; u64 exec_until; // mode of the PB-Scheduler (introduced to improve the readability) - // one of PB_DISABLED_MODE, PB_EXEC_MODE, PB_FREE_MODE + // one of PB_DISABLED_MODE, PB_EXEC_MODE, PB_UALL_MODE int mode; int measure_k; @@ -875,14 +875,14 @@ static inline int determine_next_mode_pb(u64 time, if (pb->mode == PB_EXEC_MODE) { mode = (pb->exec_until < time) - ? PB_FREE_MODE + ? PB_UALL_MODE : PB_EXEC_MODE; } - else if (pb->mode == PB_FREE_MODE) + else if (pb->mode == PB_UALL_MODE) { - mode = (pb->free_until < time + FREE_PRE_SCHED_TIME) + mode = (pb->uall_until < time) ? PB_EXEC_MODE - : PB_FREE_MODE; + : PB_UALL_MODE; } } } @@ -2052,7 +2052,7 @@ extern void init_dl_rq(struct dl_rq *dl_rq); extern void set_pb_measure_off(struct pb_rq *pb_rq); extern void set_pb_measure_on(struct pb_rq *pb_rq); extern void set_pb_plan_size(struct pb_rq *pb_rq, unsigned int size); -extern void set_pb_plan_entry(struct pb_rq *pb_rq, unsigned int i, u64 exec_time, u64 free_time); +extern void set_pb_plan_entry(struct pb_rq *pb_rq, unsigned int i, u64 exec_time, u64 uall_time); extern void cfs_bandwidth_usage_inc(void); extern void cfs_bandwidth_usage_dec(void); diff --git a/pb_utils/mod_gen/plans/plan_same_v.csv b/pb_utils/mod_gen/plans/plan_same_v.csv index 4e6082c6b207e42061575ddcb29057b36b09f4fa..ffc000a1a17003180bb6fa87a37a250db9b888a6 100644 --- a/pb_utils/mod_gen/plans/plan_same_v.csv +++ b/pb_utils/mod_gen/plans/plan_same_v.csv @@ -2,4 +2,100 @@ EXEC_TIME, IDLE_TIME 3000000000 , 3000000000 3000000000 , 3000000000 3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 +3000000000 , 3000000000 3000000000 , 0 diff --git a/pb_utils/mod_gen/tmpl/module.tt b/pb_utils/mod_gen/tmpl/module.tt index e9e447c36beaae52b17f12794ff5b1b133556431..197d9183091a23e7b9c162443c13134a74d97da5 100644 --- a/pb_utils/mod_gen/tmpl/module.tt +++ b/pb_utils/mod_gen/tmpl/module.tt @@ -6,7 +6,7 @@ MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Module that injects a loop task into the PB scheduler"); +MODULE_DESCRIPTION("PB Scheduler - Module that sets a proxy task and scheduling plan"); static int loop_thread_func(void *data) { @@ -30,19 +30,16 @@ static void init_rq(struct pb_rq *pb_rq) static int __init pb_client_init(void) { - struct task_struct *loop_task; + struct task_struct *proxy_task; struct rq *rq; - loop_task = kthread_create(loop_thread_func, NULL, "PB loop thread"); - loop_task->sched_class = &pb_sched_class; - - loop_task->policy = 7; - loop_task->state = 0; + proxy_task = kthread_create(loop_thread_func, NULL, "PB proxy thread"); + proxy_task->sched_class = &pb_sched_class; rq = this_rq(); init_rq(&rq->pb); - rq->pb.loop_task = loop_task; + rq->pb.proxy_task = proxy_task; return 0; }