sched/fair: Move record_wakee()
Since I want to make ->task_woken() conditional on the task getting migrated, we cannot use it to call record_wakee(). Move it to select_task_rq_fair(), which gets called in almost all the same conditions. The only exception is if the woken task (@p) is CPU-bound (as per the nr_cpus_allowed test in select_task_rq()). Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Andrew Hunter <ahh@google.com> Cc: Ben Segall <bsegall@google.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Mike Galbraith <efault@gmx.de> Cc: Mike Galbraith <umgwanakikbuti@gmail.com> Cc: Morten Rasmussen <morten.rasmussen@arm.com> Cc: Paul Turner <pjt@google.com> Cc: Pavan Kondeti <pkondeti@codeaurora.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: byungchul.park@lge.com Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
4eb8676517
commit
c58d25f371
|
@ -4810,24 +4810,6 @@ static unsigned long cpu_avg_load_per_task(int cpu)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void record_wakee(struct task_struct *p)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Rough decay (wiping) for cost saving, don't worry
|
|
||||||
* about the boundary, really active task won't care
|
|
||||||
* about the loss.
|
|
||||||
*/
|
|
||||||
if (time_after(jiffies, current->wakee_flip_decay_ts + HZ)) {
|
|
||||||
current->wakee_flips >>= 1;
|
|
||||||
current->wakee_flip_decay_ts = jiffies;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current->last_wakee != p) {
|
|
||||||
current->last_wakee = p;
|
|
||||||
current->wakee_flips++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void task_waking_fair(struct task_struct *p)
|
static void task_waking_fair(struct task_struct *p)
|
||||||
{
|
{
|
||||||
struct sched_entity *se = &p->se;
|
struct sched_entity *se = &p->se;
|
||||||
|
@ -4847,7 +4829,6 @@ static void task_waking_fair(struct task_struct *p)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
se->vruntime -= min_vruntime;
|
se->vruntime -= min_vruntime;
|
||||||
record_wakee(p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_FAIR_GROUP_SCHED
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
||||||
|
@ -4965,17 +4946,39 @@ static long effective_load(struct task_group *tg, int cpu, long wl, long wg)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void record_wakee(struct task_struct *p)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Only decay a single time; tasks that have less then 1 wakeup per
|
||||||
|
* jiffy will not have built up many flips.
|
||||||
|
*/
|
||||||
|
if (time_after(jiffies, current->wakee_flip_decay_ts + HZ)) {
|
||||||
|
current->wakee_flips >>= 1;
|
||||||
|
current->wakee_flip_decay_ts = jiffies;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (current->last_wakee != p) {
|
||||||
|
current->last_wakee = p;
|
||||||
|
current->wakee_flips++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Detect M:N waker/wakee relationships via a switching-frequency heuristic.
|
* Detect M:N waker/wakee relationships via a switching-frequency heuristic.
|
||||||
|
*
|
||||||
* A waker of many should wake a different task than the one last awakened
|
* A waker of many should wake a different task than the one last awakened
|
||||||
* at a frequency roughly N times higher than one of its wakees. In order
|
* at a frequency roughly N times higher than one of its wakees.
|
||||||
* to determine whether we should let the load spread vs consolodating to
|
*
|
||||||
* shared cache, we look for a minimum 'flip' frequency of llc_size in one
|
* In order to determine whether we should let the load spread vs consolidating
|
||||||
* partner, and a factor of lls_size higher frequency in the other. With
|
* to shared cache, we look for a minimum 'flip' frequency of llc_size in one
|
||||||
* both conditions met, we can be relatively sure that the relationship is
|
* partner, and a factor of lls_size higher frequency in the other.
|
||||||
* non-monogamous, with partner count exceeding socket size. Waker/wakee
|
*
|
||||||
* being client/server, worker/dispatcher, interrupt source or whatever is
|
* With both conditions met, we can be relatively sure that the relationship is
|
||||||
* irrelevant, spread criteria is apparent partner count exceeds socket size.
|
* non-monogamous, with partner count exceeding socket size.
|
||||||
|
*
|
||||||
|
* Waker/wakee being client/server, worker/dispatcher, interrupt source or
|
||||||
|
* whatever is irrelevant, spread criteria is apparent partner count exceeds
|
||||||
|
* socket size.
|
||||||
*/
|
*/
|
||||||
static int wake_wide(struct task_struct *p)
|
static int wake_wide(struct task_struct *p)
|
||||||
{
|
{
|
||||||
|
@ -5280,8 +5283,10 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
|
||||||
int want_affine = 0;
|
int want_affine = 0;
|
||||||
int sync = wake_flags & WF_SYNC;
|
int sync = wake_flags & WF_SYNC;
|
||||||
|
|
||||||
if (sd_flag & SD_BALANCE_WAKE)
|
if (sd_flag & SD_BALANCE_WAKE) {
|
||||||
|
record_wakee(p);
|
||||||
want_affine = !wake_wide(p) && cpumask_test_cpu(cpu, tsk_cpus_allowed(p));
|
want_affine = !wake_wide(p) && cpumask_test_cpu(cpu, tsk_cpus_allowed(p));
|
||||||
|
}
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
for_each_domain(cpu, tmp) {
|
for_each_domain(cpu, tmp) {
|
||||||
|
|
Loading…
Reference in New Issue