From 4469f5b4e75e64865cecbfcbf02783064c1ea4a1 Mon Sep 17 00:00:00 2001 From: Mel Gorman Date: Mar 29 2024 10:05:04 +0000 Subject: Rename and refresh patches.suse/sched-fair-Combine-EAS-check-with-root_domain-overutilized-access.patch. --- diff --git a/patches.suse/sched-fair-Combine-EAS-check-with-overutilized-access.patch b/patches.suse/sched-fair-Combine-EAS-check-with-overutilized-access.patch deleted file mode 100644 index 7941d3f..0000000 --- a/patches.suse/sched-fair-Combine-EAS-check-with-overutilized-access.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 655fff36fa50c13b9efce03aa5fa42312c1cf21d Mon Sep 17 00:00:00 2001 -From: Shrikanth Hegde -Date: Wed, 6 Mar 2024 10:24:52 +0000 -Subject: [PATCH] sched/fair: Combine EAS check with overutilized access - -Patch-mainline: Not yet, v6 under review -URL: https://lore.kernel.org/lkml/20240307085725.444486-1-sshegde@linux.ibm.com/ -References: bsc#1221157 - -Access to overutilized is always used with sched_energy_enabled in -the pattern: - -if (sched_energy_enabled && !overutilized) - do something - -So modify the helper function to return this pattern. This is more -readable code as it would say, do something when root domain is not -overutilized. - -No change in functionality intended. - -Suggested-by: Vincent Guittot -Signed-off-by: Shrikanth Hegde -Signed-off-by: Mel Gorman - ---- - kernel/sched/fair.c | 24 +++++++++--------------- - 1 file changed, 9 insertions(+), 15 deletions(-) - -diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index 33ce8880e652..a71ef7e2230b 100644 ---- a/kernel/sched/fair.c -+++ b/kernel/sched/fair.c -@@ -6584,12 +6584,11 @@ static inline bool cpu_overutilized(int cpu) - } - - /* -- * Ensure that caller can do EAS. overutilized value -- * make sense only if EAS is enabled -+ * overutilized value make sense only if EAS is enabled - */ --static inline int is_rd_overutilized(struct root_domain *rd) -+static inline int is_rd_not_overutilized(struct root_domain *rd) - { -- return READ_ONCE(rd->overutilized); -+ return sched_energy_enabled() && !READ_ONCE(rd->overutilized); - } - - static inline void set_rd_overutilized_status(struct root_domain *rd, -@@ -6608,10 +6607,8 @@ static inline void check_update_overutilized_status(struct rq *rq) - * overutilized field is used for load balancing decisions only - * if energy aware scheduler is being used - */ -- if (!sched_energy_enabled()) -- return; - -- if (!is_rd_overutilized(rq->rd) && cpu_overutilized(rq->cpu)) -+ if (is_rd_not_overutilized(rq->rd) && cpu_overutilized(rq->cpu)) - set_rd_overutilized_status(rq->rd, SG_OVERUTILIZED); - } - #else -@@ -7886,7 +7883,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu) - - rcu_read_lock(); - pd = rcu_dereference(rd->pd); -- if (!pd || is_rd_overutilized(rd)) -+ if (!pd) - goto unlock; - - /* -@@ -8089,7 +8086,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags) - cpumask_test_cpu(cpu, p->cpus_ptr)) - return cpu; - -- if (sched_energy_enabled()) { -+ if (is_rd_not_overutilized(this_rq()->rd)) { - new_cpu = find_energy_efficient_cpu(p, prev_cpu); - if (new_cpu >= 0) - return new_cpu; -@@ -10900,12 +10897,9 @@ static struct sched_group *find_busiest_group(struct lb_env *env) - if (busiest->group_type == group_misfit_task) - goto force_balance; - -- if (sched_energy_enabled()) { -- struct root_domain *rd = env->dst_rq->rd; -- -- if (rcu_dereference(rd->pd) && !is_rd_overutilized(rd)) -- goto out_balanced; -- } -+ if (is_rd_not_overutilized(env->dst_rq->rd) && -+ rcu_dereference(env->dst_rq->rd->pd)) -+ goto out_balanced; - - /* ASYM feature bypasses nice load balance check */ - if (busiest->group_type == group_asym_packing) diff --git a/patches.suse/sched-fair-Combine-EAS-check-with-root_domain-overutilized-access.patch b/patches.suse/sched-fair-Combine-EAS-check-with-root_domain-overutilized-access.patch new file mode 100644 index 0000000..4790cf1 --- /dev/null +++ b/patches.suse/sched-fair-Combine-EAS-check-with-root_domain-overutilized-access.patch @@ -0,0 +1,94 @@ +From 52ef2457bf5c6e9f6a3e3c2db216c39ddc83b553 Mon Sep 17 00:00:00 2001 +From: Shrikanth Hegde +Date: Tue, 26 Mar 2024 20:56:16 +0530 +Subject: [PATCH] sched/fair: Combine EAS check with root_domain::overutilized + access + +References: bsc#1221157 +Git-commit: 902e786c4a54a2c4f7462b9026bb56610888db3d +Patch-mainline: Queued in subsystem maintainer repository +Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git + +Access to root_domainoverutilized is always used with sched_energy_enabled in +the pattern: + + if (sched_energy_enabled && !overutilized) + do something + +So modify the helper function to utilize this pattern. This is more +readable code as it would say, do something when root domain is not +overutilized. This function always return true when EAS is disabled. + +No change in functionality intended. + +Suggested-by: Vincent Guittot +Signed-off-by: Shrikanth Hegde +Signed-off-by: Ingo Molnar +Link: https://lore.kernel.org/r/20240326152616.380999-1-sshegde@linux.ibm.com +Signed-off-by: Mel Gorman +--- + kernel/sched/fair.c | 20 +++++++------------- + 1 file changed, 7 insertions(+), 13 deletions(-) + +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c +index 33ce8880e652..bd8d76258659 100644 +--- a/kernel/sched/fair.c ++++ b/kernel/sched/fair.c +@@ -6584,12 +6584,11 @@ static inline bool cpu_overutilized(int cpu) + } + + /* +- * Ensure that caller can do EAS. overutilized value +- * make sense only if EAS is enabled ++ * overutilized value make sense only if EAS is enabled + */ + static inline int is_rd_overutilized(struct root_domain *rd) + { +- return READ_ONCE(rd->overutilized); ++ return !sched_energy_enabled() || READ_ONCE(rd->overutilized); + } + + static inline void set_rd_overutilized_status(struct root_domain *rd, +@@ -6608,8 +6607,6 @@ static inline void check_update_overutilized_status(struct rq *rq) + * overutilized field is used for load balancing decisions only + * if energy aware scheduler is being used + */ +- if (!sched_energy_enabled()) +- return; + + if (!is_rd_overutilized(rq->rd) && cpu_overutilized(rq->cpu)) + set_rd_overutilized_status(rq->rd, SG_OVERUTILIZED); +@@ -7886,7 +7883,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu) + + rcu_read_lock(); + pd = rcu_dereference(rd->pd); +- if (!pd || is_rd_overutilized(rd)) ++ if (!pd) + goto unlock; + + /* +@@ -8089,7 +8086,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags) + cpumask_test_cpu(cpu, p->cpus_ptr)) + return cpu; + +- if (sched_energy_enabled()) { ++ if (!is_rd_overutilized(this_rq()->rd)) { + new_cpu = find_energy_efficient_cpu(p, prev_cpu); + if (new_cpu >= 0) + return new_cpu; +@@ -10900,12 +10897,9 @@ static struct sched_group *find_busiest_group(struct lb_env *env) + if (busiest->group_type == group_misfit_task) + goto force_balance; + +- if (sched_energy_enabled()) { +- struct root_domain *rd = env->dst_rq->rd; +- +- if (rcu_dereference(rd->pd) && !is_rd_overutilized(rd)) +- goto out_balanced; +- } ++ if (!is_rd_overutilized(env->dst_rq->rd) && ++ rcu_dereference(env->dst_rq->rd->pd)) ++ goto out_balanced; + + /* ASYM feature bypasses nice load balance check */ + if (busiest->group_type == group_asym_packing) diff --git a/series.conf b/series.conf index cd43973..117b24c 100644 --- a/series.conf +++ b/series.conf @@ -20055,6 +20055,11 @@ patches.suse/net-sched-Add-module-alias-for-sch_fq_pie.patch patches.suse/net-bnx2x-Prevent-access-to-a-freed-page-in-page_poo.patch + # tip/tip + patches.suse/sched-fair-Add-EAS-checks-before-updating-root_domain-overutilized.patch + patches.suse/sched-fair-Introduce-is_rd_overutilized-helper-function-to-access-root_domain-overutilized.patch + patches.suse/sched-fair-Combine-EAS-check-with-root_domain-overutilized-access.patch + ######################################################## # end of sorted patches ######################################################## @@ -20157,11 +20162,6 @@ # from scratch. +mgorman patches.suse/sched-fair-Revert-update_pick_idlest-Select-group-with-lowest-group_util-when-idle_cpus-are-equal.patch - # Cache line contention reduction pending review upstream - patches.suse/sched-fair-Add-EAS-checks-before-updating-root_domain-overutilized.patch - patches.suse/sched-fair-Introduce-is_rd_overutilized-helper-function-to-access-root_domain-overutilized.patch - patches.suse/sched-fair-Combine-EAS-check-with-overutilized-access.patch - ######################################################## # Memory management ########################################################