mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 11:37:06 +02:00
sched/walt: Restrict new idle load balance based on avg_idle
Optimize the new idle load balance entry conditions to improve the performance/power. Change-Id: Ia859bc499e320e36e3ff32be8d690c53152a26cc Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
This commit is contained in:
parent
e96b1cfd3c
commit
2b4af30325
|
|
@ -538,6 +538,25 @@ static void walt_lb_tick(void *unused, struct rq *rq)
|
|||
raw_spin_unlock_irqrestore(&walt_lb_migration_lock, flags);
|
||||
}
|
||||
|
||||
static bool should_help_min_cap(int this_cpu)
|
||||
{
|
||||
int cpu;
|
||||
|
||||
if (!sysctl_sched_force_lb_enable || is_min_capacity_cpu(this_cpu))
|
||||
return false;
|
||||
|
||||
for_each_cpu(cpu, &cpu_array[0][0]) {
|
||||
struct walt_rq *wrq = (struct walt_rq *) cpu_rq(cpu)->android_vendor_data1;
|
||||
|
||||
if (wrq->walt_stats.nr_big_tasks)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* similar to sysctl_sched_migration_cost */
|
||||
#define NEWIDLE_BALANCE_THRESHOLD 500000
|
||||
static void walt_newidle_balance(void *unused, struct rq *this_rq,
|
||||
struct rq_flags *rf, int *pulled_task,
|
||||
int *done)
|
||||
|
|
@ -547,6 +566,8 @@ static void walt_newidle_balance(void *unused, struct rq *this_rq,
|
|||
int order_index = wrq->cluster->id;
|
||||
int cluster = 0;
|
||||
int busy_cpu;
|
||||
bool enough_idle = (this_rq->avg_idle > NEWIDLE_BALANCE_THRESHOLD);
|
||||
bool help_min_cap;
|
||||
|
||||
if (unlikely(!cpu_array))
|
||||
return;
|
||||
|
|
@ -571,6 +592,10 @@ static void walt_newidle_balance(void *unused, struct rq *this_rq,
|
|||
if (!READ_ONCE(this_rq->rd->overload))
|
||||
return;
|
||||
|
||||
if (atomic_read(&this_rq->nr_iowait) && !enough_idle)
|
||||
return;
|
||||
|
||||
help_min_cap = should_help_min_cap(this_cpu);
|
||||
rq_unpin_lock(this_rq, rf);
|
||||
raw_spin_unlock(&this_rq->lock);
|
||||
|
||||
|
|
@ -588,6 +613,8 @@ static void walt_newidle_balance(void *unused, struct rq *this_rq,
|
|||
if (busy_cpu != -1 || this_rq->nr_running > 0)
|
||||
break;
|
||||
|
||||
if (!enough_idle && !help_min_cap)
|
||||
break;
|
||||
} while (++cluster < num_sched_clusters);
|
||||
|
||||
/* sanity checks before attempting the pull */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user