diff --git a/kernel/sched/pb.c b/kernel/sched/pb.c index 764589e0321cdebb98d6fb63c57feaf771a3e71e..0648d976c149a1843eb421a6ddbe4d663cb57c2f 100644 --- a/kernel/sched/pb.c +++ b/kernel/sched/pb.c @@ -1,4 +1,6 @@ + #include "pb_internal.h" +#include "perf_error_detection.h" /* * It is possible to initialize a runqueue only if no plan is currently executed diff --git a/kernel/sched/pb.h b/kernel/sched/pb.h deleted file mode 100644 index 5813061361e50de1729edf850f123648a3ef420f..0000000000000000000000000000000000000000 --- a/kernel/sched/pb.h +++ /dev/null @@ -1,36 +0,0 @@ - -#ifndef KERNEL_SCHED_PB_H_ -#define KERNEL_SCHED_PB_H_ - -/* - * Mode of the PB scheduler - */ -enum pb_mode{ - PB_DISABLED_MODE, // PB scheduler is disabled (no plan available) - PB_EXEC_MODE, // PB task is being executed - PB_ADMIN_MODE // Admin task is being executed -}; - -#define PB_MAX_PLAN_LENGTH 100 - -/* - * Entry for PB-Task - */ -struct plan_entry { - u64 n_instr; // number of instructions for a task - u64 task_id; - struct task_struct *task_struct; // linux task struct -}; - -struct pb_init_struct { - struct plan_entry *plan; // PB plan - unsigned int size; // size of the plan - - u64 n_pb_cycles; // amount of timer ticks before admin tasks are allowed to run - u64 n_admin_cycles; // amount of timer ticks before PB tasks are allowed to run -}; - - -int pb_init_rq(struct pb_init_struct *initstr, struct rq *rq); - -#endif /* KERNEL_SCHED_PB_H_ */ diff --git a/kernel/sched/pb_internal.h b/kernel/sched/pb_internal.h index 47810245fdf65ff08c230cd41aa523425731a341..025232aa3a0d86891126fd8a1a9bea99debe1e1c 100644 --- a/kernel/sched/pb_internal.h +++ b/kernel/sched/pb_internal.h @@ -1,10 +1,7 @@ #ifndef KERNEL_SCHED_PB_INTERNAL_H_ #define KERNEL_SCHED_PB_INTERNAL_H_ -#include <linux/kthread.h> -#include <sched.h> -#include "perf_error_detection.h" -#include "pb.h" +#include "sched.h" static inline int determine_next_mode_pb(struct rq *rq); diff --git a/kernel/sched/perf_error_detection.c b/kernel/sched/perf_error_detection.c index f2fd20aa7bb4b38a7242c3fe5ec077f3208f7c88..62cdfcbc8378f24fe7a062e8542ab25d53051594 100644 --- a/kernel/sched/perf_error_detection.c +++ b/kernel/sched/perf_error_detection.c @@ -1,4 +1,5 @@ #include "perf_error_detection.h" +#include "sched.h" /* * Our understanding of perf so far. Please correct as needed. diff --git a/kernel/sched/perf_error_detection.h b/kernel/sched/perf_error_detection.h index ccd01998c842ae165b82de09204909ddfc313031..dbe9f18ff45478a074dc460bf7397c9cab68adf5 100644 --- a/kernel/sched/perf_error_detection.h +++ b/kernel/sched/perf_error_detection.h @@ -2,9 +2,6 @@ #define __PERF_ERROR_DETECTION_H #include <linux/perf_event.h> -#include <linux/smp.h> -#include "sched.h" -#include "pb_internal.h" int init_perf_event(struct plan_entry, struct perf_event **pevent); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 9f71fcaa6bf4c93140822d0065db347ab8d6e62f..88e2a36ce84e5f13bd5585cf95c09a877cf1722c 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -39,7 +39,6 @@ #include "cpuacct.h" #include <linux/perf_event.h> // For performance counter -#include "pb.h" // For PB #ifdef CONFIG_SCHED_DEBUG # define SCHED_WARN_ON(x) WARN_ONCE(x, #x) @@ -501,6 +500,34 @@ struct cfs_rq { #endif /* CONFIG_FAIR_GROUP_SCHED */ }; +/* + * Mode of the PB scheduler + */ +enum pb_mode{ + PB_DISABLED_MODE, // PB scheduler is disabled (no plan available) + PB_EXEC_MODE, // PB task is being executed + PB_ADMIN_MODE // Admin task is being executed +}; + +#define PB_MAX_PLAN_LENGTH 100 + +/* + * Entry for PB-Task + */ +struct plan_entry { + u64 n_instr; // number of instructions for a task + u64 task_id; + struct task_struct *task_struct; // linux task struct +}; + +struct pb_init_struct { + struct plan_entry *plan; // PB plan + unsigned int size; // size of the plan + + u64 n_pb_cycles; // amount of timer ticks before admin tasks are allowed to run + u64 n_admin_cycles; // amount of timer ticks before PB tasks are allowed to run +}; + struct pb_rq { struct plan_entry *plan; // PB plan unsigned int size; // size of the plan @@ -523,6 +550,8 @@ struct pb_rq { volatile int is_initialized; }; +int pb_init_rq(struct pb_init_struct *initstr, struct rq *rq); + static inline int rt_bandwidth_enabled(void) { return sysctl_sched_rt_runtime >= 0;