mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
Merge "sched/walt: Improve the scheduler"
This commit is contained in:
commit
58fb72eeee
1 changed files with 56 additions and 0 deletions
|
|
@ -1652,6 +1652,55 @@ static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
|
|||
resched_curr(rq);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SCHED_WALT
|
||||
#define WALT_RT_PULL_THRESHOLD_NS 250000
|
||||
static struct task_struct *pick_highest_pushable_task(struct rq *rq, int cpu);
|
||||
static void try_pull_rt_task(struct rq *this_rq)
|
||||
{
|
||||
int i, this_cpu = this_rq->cpu, src_cpu = this_cpu;
|
||||
struct rq *src_rq;
|
||||
struct task_struct *p;
|
||||
|
||||
if (sched_rt_runnable(this_rq))
|
||||
return;
|
||||
|
||||
for_each_possible_cpu(i) {
|
||||
struct rq *rq = cpu_rq(i);
|
||||
|
||||
if (!has_pushable_tasks(rq))
|
||||
continue;
|
||||
|
||||
src_cpu = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (src_cpu == this_cpu)
|
||||
return;
|
||||
|
||||
src_rq = cpu_rq(src_cpu);
|
||||
double_lock_balance(this_rq, src_rq);
|
||||
|
||||
/* lock is dropped, so check again */
|
||||
if (sched_rt_runnable(this_rq))
|
||||
goto unlock;
|
||||
|
||||
p = pick_highest_pushable_task(src_rq, this_cpu);
|
||||
|
||||
if (!p)
|
||||
goto unlock;
|
||||
|
||||
if (sched_ktime_clock() - p->wts.last_wake_ts <
|
||||
WALT_RT_PULL_THRESHOLD_NS)
|
||||
goto unlock;
|
||||
|
||||
deactivate_task(src_rq, p, 0);
|
||||
set_task_cpu(p, this_cpu);
|
||||
activate_task(this_rq, p, 0);
|
||||
unlock:
|
||||
double_unlock_balance(this_rq, src_rq);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int balance_rt(struct rq *rq, struct task_struct *p, struct rq_flags *rf)
|
||||
{
|
||||
if (!on_rt_rq(&p->rt) && need_pull_rt_task(rq, p)) {
|
||||
|
|
@ -1662,7 +1711,14 @@ static int balance_rt(struct rq *rq, struct task_struct *p, struct rq_flags *rf)
|
|||
* not yet started the picking loop.
|
||||
*/
|
||||
rq_unpin_lock(rq, rf);
|
||||
#ifndef CONFIG_SCHED_WALT
|
||||
pull_rt_task(rq);
|
||||
#else
|
||||
if (rt_overloaded(rq))
|
||||
pull_rt_task(rq);
|
||||
else
|
||||
try_pull_rt_task(rq);
|
||||
#endif
|
||||
rq_repin_lock(rq, rf);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue