Merge "sched: use wake_q length only when WALT is enabled"

This commit is contained in:
qctecmdr 2020-06-22 20:50:37 -07:00 • committed by Gerrit - the friendly Code Review server
commit 5f30feb7a6
7 changed files with 46 additions and 1 deletions

View file

@ -2187,15 +2187,19 @@ out:
*/
static inline
int select_task_rq(struct task_struct *p, int cpu, int sd_flags, int wake_flags,
int sibling_count_hint)
__attribute__((unused))int sibling_count_hint)
{
bool allow_isolated = (p->flags & PF_KTHREAD);
lockdep_assert_held(&p->pi_lock);
if (p->nr_cpus_allowed > 1)
#ifdef CONFIG_SCHED_WALT
cpu = p->sched_class->select_task_rq(p, cpu, sd_flags, wake_flags,
sibling_count_hint);
#else
cpu = p->sched_class->select_task_rq(p, cpu, sd_flags, wake_flags);
#endif
else
cpu = cpumask_any(p->cpus_ptr);
@ -3624,7 +3628,11 @@ void sched_exec(void)
return;
raw_spin_lock_irqsave(&p->pi_lock, flags);
#ifdef CONFIG_SCHED_WALT
dest_cpu = p->sched_class->select_task_rq(p, task_cpu(p), SD_BALANCE_EXEC, 0, 1);
#else
dest_cpu = p->sched_class->select_task_rq(p, task_cpu(p), SD_BALANCE_EXEC, 0);
#endif
if (dest_cpu == smp_processor_id())
goto unlock;

View file

@ -1602,8 +1602,12 @@ static void yield_task_dl(struct rq *rq)
static int find_later_rq(struct task_struct *task);
static int
#ifdef CONFIG_SCHED_WALT
select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags,
int sibling_count_hint)
#else
select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags)
#endif
{
struct task_struct *curr;
struct rq *rq;

View file

@ -7218,8 +7218,12 @@ fail:
* preempt must be disabled.
*/
static int
#ifdef CONFIG_SCHED_WALT
select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_flags,
int sibling_count_hint)
#else
select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_flags)
#endif
{
struct sched_domain *tmp, *sd = NULL;
int cpu = smp_processor_id();
@ -7229,8 +7233,12 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
if (sched_energy_enabled()) {
rcu_read_lock();
#ifdef CONFIG_SCHED_WALT
new_cpu = find_energy_efficient_cpu(p, prev_cpu, sync,
sibling_count_hint);
#else
new_cpu = find_energy_efficient_cpu(p, prev_cpu, sync, 1);
#endif
if (unlikely(new_cpu < 0))
new_cpu = prev_cpu;
rcu_read_unlock();
@ -7241,15 +7249,24 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
record_wakee(p);
if (sched_energy_enabled()) {
#ifdef CONFIG_SCHED_WALT
new_cpu = find_energy_efficient_cpu(p, prev_cpu, sync,
sibling_count_hint);
#else
new_cpu = find_energy_efficient_cpu(p, prev_cpu, sync, 1);
#endif
if (new_cpu >= 0)
return new_cpu;
new_cpu = prev_cpu;
}
#ifdef CONFIG_SCHED_WALT
want_affine = !wake_wide(p, sibling_count_hint) &&
cpumask_test_cpu(cpu, p->cpus_ptr);
#else
want_affine = !wake_wide(p, 1) &&
cpumask_test_cpu(cpu, p->cpus_ptr);
#endif
}
rcu_read_lock();

View file

@ -364,8 +364,12 @@ void cpu_startup_entry(enum cpuhp_state state)
#ifdef CONFIG_SMP
static int
#ifdef CONFIG_SCHED_WALT
select_task_rq_idle(struct task_struct *p, int cpu, int sd_flag, int flags,
int sibling_count_hint)
#else
select_task_rq_idle(struct task_struct *p, int cpu, int sd_flag, int flags)
#endif
{
return task_cpu(p); /* IDLE tasks as never migrated */
}

View file

@ -1521,8 +1521,12 @@ task_may_not_preempt(struct task_struct *task, int cpu)
}
static int
#ifdef CONFIG_SCHED_WALT
select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags,
int sibling_count_hint)
#else
select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags)
#endif
{
struct task_struct *curr;
struct rq *rq;

View file

@ -1880,8 +1880,12 @@ struct sched_class {
#ifdef CONFIG_SMP
int (*balance)(struct rq *rq, struct task_struct *prev, struct rq_flags *rf);
#ifdef CONFIG_SCHED_WALT
int (*select_task_rq)(struct task_struct *p, int task_cpu, int sd_flag, int flags,
int subling_count_hint);
#else
int (*select_task_rq)(struct task_struct *p, int task_cpu, int sd_flag, int flags);
#endif
void (*migrate_task_rq)(struct task_struct *p, int new_cpu);
void (*task_woken)(struct rq *this_rq, struct task_struct *task);

View file

@ -12,8 +12,12 @@
#ifdef CONFIG_SMP
static int
#ifdef CONFIG_SCHED_WALT
select_task_rq_stop(struct task_struct *p, int cpu, int sd_flag, int flags,
int sibling_count_hint)
#else
select_task_rq_stop(struct task_struct *p, int cpu, int sd_flag, int flags)
#endif
{
return task_cpu(p); /* stop tasks as never migrate */
}