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

Commit

Permalink
POWERSAVE_LB: If all cpus are non-idle, then fallback
Browse files Browse the repository at this point in the history
    to normal TT balancing. Since no energy
    saving at this point, at least try to
    use cpu affain.
  • Loading branch information
hamadmarri committed Dec 14, 2021
1 parent 71d0bff commit 68810f7
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 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..ad79be3d4c45
index 000000000000..8c1097870394
--- /dev/null
+++ b/kernel/sched/bs.c
@@ -0,0 +1,1876 @@
@@ -0,0 +1,1888 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * TT Scheduler Class (SCHED_NORMAL/SCHED_BATCH)
Expand Down Expand Up @@ -1186,6 +1186,7 @@ index 000000000000..ad79be3d4c45
+ int target = -1, cpu;
+ struct tt_node *ttn = &p->se.tt_node;
+ unsigned int min = ~0;
+ bool all_non_idle = true;
+
+ /*
+ * If type is realtime, interactive, or no type,
Expand All @@ -1198,15 +1199,26 @@ index 000000000000..ad79be3d4c45
+ if (unlikely(!cpumask_test_cpu(cpu, p->cpus_ptr)))
+ continue;
+
+ if (idle_cpu(cpu))
+ if (idle_cpu(cpu)) {
+ all_non_idle = false;
+ continue;
+ }
+
+ if (cpu_rq(cpu)->nr_running < min) {
+ target = cpu;
+ min = cpu_rq(cpu)->nr_running;
+ }
+ }
+
+ /*
+ * If all cpus are non-idle, then fallback
+ * to normal TT balancing. Since no energy
+ * saving at this point, at least try to
+ * use cpu affain.
+ */
+ if (all_non_idle)
+ return -1;
+
+ return target;
+}
+
Expand Down

0 comments on commit 68810f7

Please sign in to comment.