[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y2O3nDrvcy+KuGg1@hirez.programming.kicks-ass.net>
Date: Thu, 3 Nov 2022 13:44:12 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Chen Yu <yu.c.chen@...el.com>
Cc: Vincent Guittot <vincent.guittot@...aro.org>,
Tim Chen <tim.c.chen@...el.com>,
Mel Gorman <mgorman@...hsingularity.net>,
Juri Lelli <juri.lelli@...hat.com>,
Rik van Riel <riel@...riel.com>,
Aaron Lu <aaron.lu@...el.com>,
Abel Wu <wuyun.abel@...edance.com>,
K Prateek Nayak <kprateek.nayak@....com>,
Yicong Yang <yangyicong@...ilicon.com>,
"Gautham R . Shenoy" <gautham.shenoy@....com>,
Ingo Molnar <mingo@...hat.com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
Hillf Danton <hdanton@...a.com>,
Honglei Wang <wanghonglei@...ichuxing.com>,
Len Brown <len.brown@...el.com>,
Chen Yu <yu.chen.surf@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v2 1/2] sched/fair: Introduce short duration task
check
On Sun, Oct 23, 2022 at 11:32:31PM +0800, Chen Yu wrote:
> + if (sched_feat(SIS_SHORT) && !prev->on_rq) {
> + /*
> + * sum_exec_runtime has been updated in update_curr()
> + * because we reach here via dequeue.
> + */
> + this_dur_avg = se->sum_exec_runtime - se->prev_sum_runtime_vol;
> + /*
> + * Record the accumulated runtime when task voluntarily
> + * switches out. End of old duration period, a new period
> + * starts.
> + */
> + se->prev_sum_runtime_vol = se->sum_exec_runtime;
> +
> + last_dur_avg = se->dur_avg;
> + delta = this_dur_avg - last_dur_avg;
> + /* consider large change to avoid frequent update */
> + if (abs(delta) >= sysctl_sched_min_granularity) {
> + /*
> + * If it is the first time the task starts to
> + * record dur_avg, discard the initial value 0.
> + * Otherwise, calculate the EWMA.
> + */
> + if (unlikely(!this_dur_avg))
> + se->dur_avg = this_dur_avg;
> + else
> + update_avg(&se->dur_avg, this_dur_avg);
> + }
> + }
This seems excessively convoluted; what's wrong with something like:
if (sched_feat(SIS_SHORT) && !prev->on_rq) {
u64 this_dur = se->sum_exec_runtime - se->prev_sum_exec_runtime_vol;
se->prev_sum_exec_runtime_vol = se->sum_exec_runtime;
update_avg(&se->dur_avg, this_dur);
}
All that other stuff just makes it unreadable and probably slower.
Powered by blists - more mailing lists