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

Commit

Permalink
Each cpu is responsible for push_to_grq, instead of CPU0
Browse files Browse the repository at this point in the history
  • Loading branch information
hamadmarri committed Dec 11, 2021
1 parent 869ff16 commit fdc9e2c
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions patches/5.15/tt-5.15.patch
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ index 978fcfca5871..bfde8e0d851b 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..bca0de488e0c
index 000000000000..4f650734b5bb
--- /dev/null
+++ b/kernel/sched/bs.c
@@ -0,0 +1,1782 @@
@@ -0,0 +1,1784 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * TT Scheduler Class (SCHED_NORMAL/SCHED_BATCH)
Expand Down Expand Up @@ -1755,6 +1755,8 @@ index 000000000000..bca0de488e0c
+ idle_pull_global_candidate(this_rq);
+ else
+ active_pull_global_candidate(this_rq, 1);
+ } else if (IS_GRQ_BL_ENABLED) {
+ push_to_grq(this_rq);
+ }
+
+ if (this_cpu != 0)
Expand Down Expand Up @@ -2243,10 +2245,10 @@ index 000000000000..b3d99cf13576
+#endif
diff --git a/kernel/sched/bs_nohz.h b/kernel/sched/bs_nohz.h
new file mode 100644
index 000000000000..f1ce0b979325
index 000000000000..363160c05b83
--- /dev/null
+++ b/kernel/sched/bs_nohz.h
@@ -0,0 +1,891 @@
@@ -0,0 +1,881 @@
+
+#ifdef CONFIG_NO_HZ_COMMON
+
Expand Down Expand Up @@ -3073,44 +3075,34 @@ index 000000000000..f1ce0b979325
+{
+ int cpu;
+ struct rq *rq;
+ struct cpumask idle_mask;
+ struct cpumask non_idle_mask;
+ bool balance_time;
+ bool balance;
+ int pulled = 0;
+
+ cpumask_clear(&non_idle_mask);
+
+ /* first, push to grq*/
+ for_each_online_cpu(cpu) {
+ if (cpu == 0) continue;
+ if (!idle_cpu(cpu)) {
+ push_to_grq(cpu_rq(cpu));
+ cpumask_set_cpu(cpu, &non_idle_mask);
+ } else {
+ cpumask_set_cpu(cpu, &idle_mask);
+ }
+ }
+ rq = cpu_rq(cpu);
+ pulled = 0;
+
+ /* second, idle cpus pull first */
+ for_each_cpu(cpu, &idle_mask) {
+ if (cpu == 0 || !idle_cpu(cpu))
+ continue;
+ if (idle_cpu(cpu))
+ pulled = pull_from_grq(rq);
+ else
+ cpumask_set_cpu(cpu, &non_idle_mask);
+
+ rq = cpu_rq(cpu);
+ pulled = pull_from_grq(rq);
+ update_grq_next_balance(rq, pulled);
+ }
+
+ /* last, non idle pull */
+ for_each_cpu(cpu, &non_idle_mask) {
+ rq = cpu_rq(cpu);
+ balance_time = time_after_eq(jiffies, rq->grq_next_balance);
+ balance = time_after_eq(jiffies, rq->grq_next_balance);
+ pulled = 0;
+
+ /* mybe it is idle now */
+ if (idle_cpu(cpu))
+ pulled = pull_from_grq(cpu_rq(cpu));
+ else if (tt_grq_balance_ms == 0 || balance_time)
+ pulled = pull_from_grq(rq);
+ else if (tt_grq_balance_ms == 0 || balance)
+ /* if not idle, try pull every grq_next_balance */
+ pulled = try_pull_from_grq(rq);
+
Expand Down

0 comments on commit fdc9e2c

Please sign in to comment.