summaryrefslogtreecommitdiff
path: root/kernel/sched/core.c
diff options
context:
space:
mode:
authorQais Yousef <qyousef@layalina.io>2024-02-23 15:57:48 +0000
committerJens Axboe <axboe@kernel.dk>2024-02-24 12:48:01 -0700
commitb361c9027b4e4159e7bcca4eb64fd26507c19994 (patch)
tree7fc9b8f0e93589daec94a28825323acae5aeb688 /kernel/sched/core.c
parent8a08c5fd89b447a7de7eb293a7a274c46b932ba2 (diff)
sched: Add a new function to compare if two cpus have the same capacity
The new helper function is needed to help blk-mq check if it needs to dispatch the softirq on another CPU to match the performance level the IO requester is running at. This is important on HMP systems where not all CPUs have the same compute capacity. Signed-off-by: Qais Yousef <qyousef@layalina.io> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20240223155749.2958009-2-qyousef@layalina.io Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r--kernel/sched/core.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 083f2258182d..540f229700b6 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3955,6 +3955,17 @@ void wake_up_if_idle(int cpu)
}
}
+bool cpus_equal_capacity(int this_cpu, int that_cpu)
+{
+ if (!sched_asym_cpucap_active())
+ return true;
+
+ if (this_cpu == that_cpu)
+ return true;
+
+ return arch_scale_cpu_capacity(this_cpu) == arch_scale_cpu_capacity(that_cpu);
+}
+
bool cpus_share_cache(int this_cpu, int that_cpu)
{
if (this_cpu == that_cpu)