[PATCH v2 7/7] x86/sched/itmt: Consider the idle state of SMT siblings

From: Ricardo Neri
Date: Tue Nov 22 2022 - 15:28:51 EST


Cores with more than one busy SMT sibling need help from fully idle cores,
even if they have lower priority. Return a priority of 0 if any of the SMT
siblings of a CPU are busy. This lets lower-priority idle cores pull tasks
from the CPU.

Only do this if the scheduler cares about the idle state of the siblings.

Cc: Ben Segall <bsegall@xxxxxxxxxx>
Cc: Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>
Cc: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
Cc: Len Brown <len.brown@xxxxxxxxx>
Cc: Mel Gorman <mgorman@xxxxxxx>
Cc: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Cc: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Tim C. Chen <tim.c.chen@xxxxxxxxx>
Cc: Valentin Schneider <vschneid@xxxxxxxxxx>
Cc: x86@xxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@xxxxxxxxxxxxxxx>
---
Changes since v1:
* Introduced this patch.
---
arch/x86/kernel/itmt.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/itmt.c b/arch/x86/kernel/itmt.c
index 2be49ce4f94a..cb22944969a1 100644
--- a/arch/x86/kernel/itmt.c
+++ b/arch/x86/kernel/itmt.c
@@ -169,7 +169,10 @@ void sched_clear_itmt_support(void)

int arch_asym_cpu_priority(int cpu, bool check_smt)
{
- return per_cpu(sched_core_priority, cpu);
+ if (!check_smt || sched_smt_siblings_idle(cpu))
+ return per_cpu(sched_core_priority, cpu);
+
+ return 0;
}

/**
--
2.25.1