From accc23ecaf41eb90927f1f7b7fb239f72ca5c9a7 Mon Sep 17 00:00:00 2001
From: Mihai Renea <mihairenea@llanberis.imp.fu-berlin.de>
Date: Fri, 22 Mar 2019 14:02:17 +0100
Subject: [PATCH] Include loop fix

---
 kernel/sched/pb.c                   |  2 ++
 kernel/sched/pb.h                   | 36 -----------------------------
 kernel/sched/pb_internal.h          |  5 +---
 kernel/sched/perf_error_detection.c |  1 +
 kernel/sched/perf_error_detection.h |  3 ---
 kernel/sched/sched.h                | 31 ++++++++++++++++++++++++-
 6 files changed, 34 insertions(+), 44 deletions(-)
 delete mode 100644 kernel/sched/pb.h

diff --git a/kernel/sched/pb.c b/kernel/sched/pb.c
index 764589e0321c..0648d976c149 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 5813061361e5..000000000000
--- 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 47810245fdf6..025232aa3a0d 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 f2fd20aa7bb4..62cdfcbc8378 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 ccd01998c842..dbe9f18ff454 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 9f71fcaa6bf4..88e2a36ce84e 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;
-- 
GitLab