Commit b361c902 authored by Qais Yousef's avatar Qais Yousef Committed by Jens Axboe

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: default avatarQais Yousef <qyousef@layalina.io>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240223155749.2958009-2-qyousef@layalina.ioSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 8a08c5fd
......@@ -176,6 +176,7 @@ extern void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
cpumask_var_t *alloc_sched_domains(unsigned int ndoms);
void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms);
bool cpus_equal_capacity(int this_cpu, int that_cpu);
bool cpus_share_cache(int this_cpu, int that_cpu);
bool cpus_share_resources(int this_cpu, int that_cpu);
......@@ -226,6 +227,11 @@ partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
{
}
static inline bool cpus_equal_capacity(int this_cpu, int that_cpu)
{
return true;
}
static inline bool cpus_share_cache(int this_cpu, int that_cpu)
{
return true;
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment