Merge "sched/fair: Improve the scheduler"

This commit is contained in:
qctecmdr 2020-01-08 08:11:29 -08:00 • committed by Gerrit - the friendly Code Review server
commit f71c15bb63
3 changed files with 14 additions and 7 deletions

View file

@ -8444,7 +8444,7 @@ void sched_account_irqtime(int cpu, struct task_struct *curr,
u64 delta, u64 wallclock)
{
struct rq *rq = cpu_rq(cpu);
unsigned long flags, nr_windows;
unsigned long flags, nr_ticks;
u64 cur_jiffies_ts;
raw_spin_lock_irqsave(&rq->lock, flags);
@ -8460,18 +8460,20 @@ void sched_account_irqtime(int cpu, struct task_struct *curr,
walt_update_task_ravg(curr, rq, IRQ_UPDATE, sched_ktime_clock(),
delta);
nr_windows = cur_jiffies_ts - rq->irqload_ts;
nr_ticks = cur_jiffies_ts - rq->irqload_ts;
if (nr_windows) {
if (nr_windows < 10) {
if (nr_ticks) {
if (nr_ticks < 10) {
/* Decay CPU's irqload by 3/4 for each window. */
rq->avg_irqload *= (3 * nr_windows);
rq->avg_irqload *= (3 * nr_ticks);
rq->avg_irqload = div64_u64(rq->avg_irqload,
4 * nr_windows);
4 * nr_ticks);
} else {
rq->avg_irqload = 0;
}
rq->avg_irqload += rq->cur_irqload;
rq->high_irqload = (rq->avg_irqload >=
sysctl_sched_cpu_high_irqload);
rq->cur_irqload = 0;
}

View file

@ -1076,6 +1076,7 @@ struct rq {
u64 cur_irqload;
u64 avg_irqload;
u64 irqload_ts;
bool high_irqload;
struct task_struct *ed_task;
struct cpu_cycle cc;
u64 old_busy_time, old_busy_time_group;

View file

@ -85,6 +85,10 @@ extern void __weak mark_task_starting(struct task_struct *p);
extern void __weak set_window_start(struct rq *rq);
extern bool __weak do_pl_notif(struct rq *rq);
/*
* This is only for tracepoints to print the avg irq load. For
* task placment considerations, use sched_cpu_high_irqload().
*/
#define SCHED_HIGH_IRQ_TIMEOUT 3
static inline u64 sched_irqload(int cpu)
{
@ -107,7 +111,7 @@ static inline u64 sched_irqload(int cpu)
static inline int sched_cpu_high_irqload(int cpu)
{
return sched_irqload(cpu) >= sysctl_sched_cpu_high_irqload;
return cpu_rq(cpu)->high_irqload;
}
static inline int exiting_task(struct task_struct *p)