Commit a52bfd73 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

sched: Add smt_gain

The idea is that multi-threading a core yields more work
capacity than a single thread, provide a way to express a
static gain for threads.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Tested-by: default avatarAndreas Herrmann <andreas.herrmann3@amd.com>
Acked-by: default avatarAndreas Herrmann <andreas.herrmann3@amd.com>
Acked-by: default avatarGautham R Shenoy <ego@in.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
LKML-Reference: <20090901083826.073345955@chello.nl>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent cc9fba7d
...@@ -921,6 +921,7 @@ struct sched_domain { ...@@ -921,6 +921,7 @@ struct sched_domain {
unsigned int newidle_idx; unsigned int newidle_idx;
unsigned int wake_idx; unsigned int wake_idx;
unsigned int forkexec_idx; unsigned int forkexec_idx;
unsigned int smt_gain;
int flags; /* See SD_* */ int flags; /* See SD_* */
enum sched_domain_level level; enum sched_domain_level level;
......
...@@ -99,6 +99,7 @@ int arch_update_cpu_topology(void); ...@@ -99,6 +99,7 @@ int arch_update_cpu_topology(void);
| SD_SHARE_CPUPOWER, \ | SD_SHARE_CPUPOWER, \
.last_balance = jiffies, \ .last_balance = jiffies, \
.balance_interval = 1, \ .balance_interval = 1, \
.smt_gain = 1178, /* 15% */ \
} }
#endif #endif
#endif /* CONFIG_SCHED_SMT */ #endif /* CONFIG_SCHED_SMT */
......
...@@ -8523,9 +8523,15 @@ static void init_sched_groups_power(int cpu, struct sched_domain *sd) ...@@ -8523,9 +8523,15 @@ static void init_sched_groups_power(int cpu, struct sched_domain *sd)
weight = cpumask_weight(sched_domain_span(sd)); weight = cpumask_weight(sched_domain_span(sd));
/* /*
* SMT siblings share the power of a single core. * SMT siblings share the power of a single core.
* Usually multiple threads get a better yield out of
* that one core than a single thread would have,
* reflect that in sd->smt_gain.
*/ */
if ((sd->flags & SD_SHARE_CPUPOWER) && weight > 1) if ((sd->flags & SD_SHARE_CPUPOWER) && weight > 1) {
power *= sd->smt_gain;
power /= weight; power /= weight;
power >>= SCHED_LOAD_SHIFT;
}
sg_inc_cpu_power(sd->groups, power); sg_inc_cpu_power(sd->groups, power);
return; return;
} }
......
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