Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f4673fc authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "sched: track soft/hard irqload per-RQ with decaying avg"

parents 8d0ed101 5fdc1d3a
Loading
Loading
Loading
Loading
+28 −5
Original line number Diff line number Diff line
@@ -1831,13 +1831,33 @@ void sched_account_irqtime(int cpu, struct task_struct *curr,
				 u64 delta, u64 wallclock)
{
	struct rq *rq = cpu_rq(cpu);
	unsigned long flags;

	if (!is_idle_task(curr))
		return;
	unsigned long flags, nr_windows;
	u64 cur_jiffies_ts;

	raw_spin_lock_irqsave(&rq->lock, flags);

	cur_jiffies_ts = get_jiffies_64();

	if (is_idle_task(curr))
		update_task_ravg(curr, rq, IRQ_UPDATE, wallclock, delta);

	nr_windows = cur_jiffies_ts - rq->irqload_ts;

	if (nr_windows) {
		if (nr_windows < 10) {
			/* Decay CPU's irqload by 3/4 for each window. */
			rq->avg_irqload *= (3 * nr_windows);
			rq->avg_irqload = div64_u64(rq->avg_irqload,
						    4 * nr_windows);
		} else {
			rq->avg_irqload = 0;
		}
		rq->avg_irqload += rq->cur_irqload;
		rq->cur_irqload = 0;
	}

	rq->cur_irqload += delta;
	rq->irqload_ts = cur_jiffies_ts;
	raw_spin_unlock_irqrestore(&rq->lock, flags);
}

@@ -8994,6 +9014,9 @@ void __init sched_init(void)
		rq->mostly_idle_load = pct_to_real(20);
		rq->mostly_idle_nr_run = 3;
		rq->mostly_idle_freq = 0;
		rq->cur_irqload = 0;
		rq->avg_irqload = 0;
		rq->irqload_ts = 0;
#ifdef CONFIG_SCHED_FREQ_INPUT
		rq->old_busy_time = 0;
		rq->curr_runnable_sum = rq->prev_runnable_sum = 0;
+4 −0
Original line number Diff line number Diff line
@@ -501,6 +501,10 @@ struct rq {
	int mostly_idle_nr_run;
	int mostly_idle_freq;

	u64 cur_irqload;
	u64 avg_irqload;
	u64 irqload_ts;

#ifdef CONFIG_SCHED_FREQ_INPUT
	unsigned int old_busy_time;
#endif