aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched/sched.h
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2011-12-07 09:07:31 -0500
committerIngo Molnar <mingo@elte.hu>2011-12-21 04:34:44 -0500
commit518cd62341786aa4e3839810832af2fbc0de1ea4 (patch)
treebd28f7fce47887e9c5d33bd772c8380255ef3065 /kernel/sched/sched.h
parent612ef28a045efadb3a98d4492ead7806a146485d (diff)
sched: Only queue remote wakeups when crossing cache boundaries
Mike reported a 13% drop in netperf TCP_RR performance due to the new remote wakeup code. Suresh too noticed some performance issues with it. Reducing the IPIs to only cross cache domains solves the observed performance issues. Reported-by: Suresh Siddha <suresh.b.siddha@intel.com> Reported-by: Mike Galbraith <efault@gmx.de> Acked-by: Suresh Siddha <suresh.b.siddha@intel.com> Acked-by: Mike Galbraith <efault@gmx.de> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Chris Mason <chris.mason@oracle.com> Cc: Dave Kleikamp <dave.kleikamp@oracle.com> Link: http://lkml.kernel.org/r/1323338531.17673.7.camel@twins Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched/sched.h')
-rw-r--r--kernel/sched/sched.h42
1 files changed, 36 insertions, 6 deletions
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index d8d3613a4055..98c0c2623db8 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -487,6 +487,14 @@ static inline int cpu_of(struct rq *rq)
487 487
488DECLARE_PER_CPU(struct rq, runqueues); 488DECLARE_PER_CPU(struct rq, runqueues);
489 489
490#define cpu_rq(cpu) (&per_cpu(runqueues, (cpu)))
491#define this_rq() (&__get_cpu_var(runqueues))
492#define task_rq(p) cpu_rq(task_cpu(p))
493#define cpu_curr(cpu) (cpu_rq(cpu)->curr)
494#define raw_rq() (&__raw_get_cpu_var(runqueues))
495
496#ifdef CONFIG_SMP
497
490#define rcu_dereference_check_sched_domain(p) \ 498#define rcu_dereference_check_sched_domain(p) \
491 rcu_dereference_check((p), \ 499 rcu_dereference_check((p), \
492 lockdep_is_held(&sched_domains_mutex)) 500 lockdep_is_held(&sched_domains_mutex))
@@ -499,15 +507,37 @@ DECLARE_PER_CPU(struct rq, runqueues);
499 * preempt-disabled sections. 507 * preempt-disabled sections.
500 */ 508 */
501#define for_each_domain(cpu, __sd) \ 509#define for_each_domain(cpu, __sd) \
502 for (__sd = rcu_dereference_check_sched_domain(cpu_rq(cpu)->sd); __sd; __sd = __sd->parent) 510 for (__sd = rcu_dereference_check_sched_domain(cpu_rq(cpu)->sd); \
511 __sd; __sd = __sd->parent)
503 512
504#define for_each_lower_domain(sd) for (; sd; sd = sd->child) 513#define for_each_lower_domain(sd) for (; sd; sd = sd->child)
505 514
506#define cpu_rq(cpu) (&per_cpu(runqueues, (cpu))) 515/**
507#define this_rq() (&__get_cpu_var(runqueues)) 516 * highest_flag_domain - Return highest sched_domain containing flag.
508#define task_rq(p) cpu_rq(task_cpu(p)) 517 * @cpu: The cpu whose highest level of sched domain is to
509#define cpu_curr(cpu) (cpu_rq(cpu)->curr) 518 * be returned.
510#define raw_rq() (&__raw_get_cpu_var(runqueues)) 519 * @flag: The flag to check for the highest sched_domain
520 * for the given cpu.
521 *
522 * Returns the highest sched_domain of a cpu which contains the given flag.
523 */
524static inline struct sched_domain *highest_flag_domain(int cpu, int flag)
525{
526 struct sched_domain *sd, *hsd = NULL;
527
528 for_each_domain(cpu, sd) {
529 if (!(sd->flags & flag))
530 break;
531 hsd = sd;
532 }
533
534 return hsd;
535}
536
537DECLARE_PER_CPU(struct sched_domain *, sd_llc);
538DECLARE_PER_CPU(int, sd_llc_id);
539
540#endif /* CONFIG_SMP */
511 541
512#include "stats.h" 542#include "stats.h"
513#include "auto_group.h" 543#include "auto_group.h"