Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
Initial work to #6
Browse files Browse the repository at this point in the history
    `YIELD_MARK` only applies if `cfs_rq->h_nr_running > 1`
    `YIELD_UNMARK` on migrate_task
  • Loading branch information
hamadmarri committed Nov 16, 2021
1 parent 93d826e commit 8c32596
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions patches/5.15/tt-5.15-r2.patch
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ index 978fcfca5871..464b134de739 100644
obj-$(CONFIG_SMP) += cpupri.o cpudeadline.o topology.o stop_task.o pelt.o
diff --git a/kernel/sched/bs.c b/kernel/sched/bs.c
new file mode 100644
index 000000000000..758cd410d6e6
index 000000000000..bbeb0c844325
--- /dev/null
+++ b/kernel/sched/bs.c
@@ -0,0 +1,1181 @@
@@ -0,0 +1,1179 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * TT Scheduler Class (SCHED_NORMAL/SCHED_BATCH)
Expand All @@ -161,9 +161,6 @@ index 000000000000..758cd410d6e6
+#define RACE_TIME 40000000
+#define FACTOR (RACE_TIME / HZ_PERIOD)
+
+#define YIELD_MARK(ttn) ((ttn)->vruntime |= 0x8000000000000000ULL)
+#define YIELD_UNMARK(ttn) ((ttn)->vruntime &= 0x7FFFFFFFFFFFFFFFULL)
+
+#define IS_REALTIME(ttn) ((ttn)->task_type == TT_REALTIME)
+#define IS_INTERACTIVE(ttn) ((ttn)->task_type == TT_INTERACTIVE)
+#define IS_NO_TYPE(ttn) ((ttn)->task_type == TT_NO_TYPE)
Expand Down Expand Up @@ -558,14 +555,15 @@ index 000000000000..758cd410d6e6
+ struct task_struct *curr = rq->curr;
+ struct cfs_rq *cfs_rq = task_cfs_rq(curr);
+
+ YIELD_MARK(&curr->se.tt_node);
+
+ /*
+ * Are we the only task in the tree?
+ */
+ if (unlikely(rq->nr_running == 1))
+ return;
+
+ if (cfs_rq->h_nr_running > 1)
+ YIELD_MARK(&curr->se.tt_node);
+
+ if (curr->policy != SCHED_BATCH) {
+ update_rq_clock(rq);
+ /*
Expand Down Expand Up @@ -1321,10 +1319,12 @@ index 000000000000..758cd410d6e6
+}
diff --git a/kernel/sched/bs.h b/kernel/sched/bs.h
new file mode 100644
index 000000000000..d413aad1d0a3
index 000000000000..721eb690abeb
--- /dev/null
+++ b/kernel/sched/bs.h
@@ -0,0 +1,305 @@
@@ -0,0 +1,306 @@
+#define YIELD_MARK(ttn) ((ttn)->vruntime |= 0x8000000000000000ULL)
+#define YIELD_UNMARK(ttn) ((ttn)->vruntime &= 0x7FFFFFFFFFFFFFFFULL)
+
+/*
+ * After fork, child runs first. If set to 0 (default) then
Expand Down Expand Up @@ -1371,13 +1371,12 @@ index 000000000000..d413aad1d0a3
+ */
+ remove_entity_load_avg(&p->se);
+ }
+
+ /* We have migrated, no longer consider this task hot */
+ p->se.exec_start = 0;
+#endif
+ /* Tell new CPU we are migrated */
+ p->se.avg.last_update_time = 0;
+
+ YIELD_UNMARK(&p->se.tt_node);
+
+ update_scan_period(p, new_cpu);
+}
+
Expand Down

0 comments on commit 8c32596

Please sign in to comment.