sched, block: Unify cache detection
The block layer has some code trying to determine if two CPUs share a cache, the scheduler has a similar function. Expose the function used by the scheduler and make the block layer use it, thereby removing the block layers usage of CONFIG_SCHED* and topology bits. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Jens Axboe <axboe@kernel.dk> Link: http://lkml.kernel.org/r/1327579450.2446.95.camel@twins
This commit is contained in:

committed by
Ingo Molnar

parent
cb297a3e43
commit
39be350127
@@ -1507,7 +1507,7 @@ static int ttwu_activate_remote(struct task_struct *p, int wake_flags)
|
||||
}
|
||||
#endif /* __ARCH_WANT_INTERRUPTS_ON_CTXSW */
|
||||
|
||||
static inline int ttwu_share_cache(int this_cpu, int that_cpu)
|
||||
bool cpus_share_cache(int this_cpu, int that_cpu)
|
||||
{
|
||||
return per_cpu(sd_llc_id, this_cpu) == per_cpu(sd_llc_id, that_cpu);
|
||||
}
|
||||
@@ -1518,7 +1518,7 @@ static void ttwu_queue(struct task_struct *p, int cpu)
|
||||
struct rq *rq = cpu_rq(cpu);
|
||||
|
||||
#if defined(CONFIG_SMP)
|
||||
if (sched_feat(TTWU_QUEUE) && !ttwu_share_cache(smp_processor_id(), cpu)) {
|
||||
if (sched_feat(TTWU_QUEUE) && !cpus_share_cache(smp_processor_id(), cpu)) {
|
||||
sched_clock_cpu(cpu); /* sync clocks x-cpu */
|
||||
ttwu_queue_remote(p, cpu);
|
||||
return;
|
||||
@@ -5754,7 +5754,7 @@ static void destroy_sched_domains(struct sched_domain *sd, int cpu)
|
||||
*
|
||||
* Also keep a unique ID per domain (we use the first cpu number in
|
||||
* the cpumask of the domain), this allows us to quickly tell if
|
||||
* two cpus are in the same cache domain, see ttwu_share_cache().
|
||||
* two cpus are in the same cache domain, see cpus_share_cache().
|
||||
*/
|
||||
DEFINE_PER_CPU(struct sched_domain *, sd_llc);
|
||||
DEFINE_PER_CPU(int, sd_llc_id);
|
||||
|
Reference in New Issue
Block a user