[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZnoIRnCZaN_oHQ6N@slm.duckdns.org>
Date: Mon, 24 Jun 2024 13:59:02 -1000
From: Tejun Heo <tj@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: torvalds@...ux-foundation.org, mingo@...hat.com, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
bristot@...hat.com, vschneid@...hat.com, ast@...nel.org,
daniel@...earbox.net, andrii@...nel.org, martin.lau@...nel.org,
joshdon@...gle.com, brho@...gle.com, pjt@...gle.com,
derkling@...gle.com, haoluo@...gle.com, dvernet@...a.com,
dschatzberg@...a.com, dskarlat@...cmu.edu, riel@...riel.com,
changwoo@...lia.com, himadrics@...ia.fr, memxor@...il.com,
andrea.righi@...onical.com, joel@...lfernandes.org,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
kernel-team@...a.com
Subject: Re: [PATCH 04/39] sched: Add sched_class->reweight_task()
Hello, Peter.
On Mon, Jun 24, 2024 at 12:23:31PM +0200, Peter Zijlstra wrote:
> This reminds me, I think we have a bug here...
>
> https://lkml.kernel.org/r/20240422094157.GA34453@noisy.programming.kicks-ass.net
>
> I *think* we want something like the below, hmm?
>
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 0935f9d4bb7b..32a40d85c0b1 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1328,15 +1328,15 @@ int tg_nop(struct task_group *tg, void *data)
> void set_load_weight(struct task_struct *p, bool update_load)
> {
> int prio = p->static_prio - MAX_RT_PRIO;
> - struct load_weight *load = &p->se.load;
> + unsigned long weight;
> + u32 inv_weight;
>
> - /*
> - * SCHED_IDLE tasks get minimal weight:
> - */
> if (task_has_idle_policy(p)) {
> - load->weight = scale_load(WEIGHT_IDLEPRIO);
> - load->inv_weight = WMULT_IDLEPRIO;
> - return;
> + weight = scale_load(WEIGHT_IDLEPRIO);
> + inv_weight = WMULT_IDLEPRIO;
> + } else {
> + weight = scale_load(sched_prio_to_weight[prio]);
> + inv_weight = sched_prio_to_wmult[prio];
Hmmm... sorry but I'm a bit confused again. Isn't the code doing the same
thing before and after?
Before, if @p is SCHED_IDLE, @p->se.load is set to idle values and the
function returns. If @update_load && fair, calls reweight_task(). Otherwise,
update @p->se.load is updated according to @prio. After the patch, @weight
and @inv_weight calcuations are moved to set_load_weight() but it ends up
with the same result for all three cases.
Were you trying to say that if the idle policy were to implement
->reweight_task(), it wouldn't be called?
Thanks.
--
tejun
Powered by blists - more mailing lists