The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Xuewen Yan <xuewen.yan94@gmail.com>
Cc: Hongyan Xia <hongyan.xia2@arm.com>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>,
	Andrea Righi <arighi@nvidia.com>,
	Changwoo Min <changwoo@igalia.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/uclamp: Let each sched_class handle uclamp
Date: Fri, 7 Mar 2025 19:32:07 +0100	[thread overview]
Message-ID: <bf5a70bf-3d13-4b3b-a3ef-804998b21fe9@arm.com> (raw)
In-Reply-To: <CAB8ipk_627GF+TV5u=6DK_3aRUHW8qGYwmN+KXMq_Cg-+Say1Q@mail.gmail.com>

On 06/03/2025 13:01, Xuewen Yan wrote:
> On Thu, Mar 6, 2025 at 2:24 AM Dietmar Eggemann
> <dietmar.eggemann@arm.com> wrote:
>>
>> On 27/02/2025 14:54, Hongyan Xia wrote:
>>
>> [...]
>>
>>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>>> index 857808da23d8..7e5a653811ad 100644
>>> --- a/kernel/sched/fair.c
>>> +++ b/kernel/sched/fair.c
>>> @@ -6941,8 +6941,10 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
>>>        * Let's add the task's estimated utilization to the cfs_rq's
>>>        * estimated utilization, before we update schedutil.
>>>        */
>>> -     if (!(p->se.sched_delayed && (task_on_rq_migrating(p) || (flags & ENQUEUE_RESTORE))))
>>> +     if (!(p->se.sched_delayed && (task_on_rq_migrating(p) || (flags & ENQUEUE_RESTORE)))) {
>>> +             uclamp_rq_inc(rq, p);
>>>               util_est_enqueue(&rq->cfs, p);
>>> +     }
>>
>> So you want to have p uclamp-enqueued so that its uclamp_min value
>> counts for the cpufreq_update_util()/cfs_rq_util_change() calls later in
>> enqueue_task_fair?
>>
>>   if (p->in_iowait)
>>     cpufreq_update_util(rq, SCHED_CPUFREQ_IOWAIT);
>>
>>   enqueue_entity() -> update_load_avg() -> cfs_rq_util_change() ->
>>   cpufreq_update_util()
>>
>> But if you do this before requeue_delayed_entity() (1) you will not
>> uclamp-enqueue p which got his ->sched_delayed just cleared in (1)?
>>
> 
> Could we change to the following:
> 
> when enqueue:
> 
> -     if (!(p->se.sched_delayed && (task_on_rq_migrating(p) || (flags
> & ENQUEUE_RESTORE))))
> +     if (!(p->se.sched_delayed && !(flags & ENQUEUE_DELAYED)))

Why you want to check ENQUEUE_DELAYED as well here? Isn't
!p->se.sched_delayed implying !ENQUEUE_DELAYED).

> +             uclamp_rq_inc(rq, p);
>                util_est_enqueue(&rq->cfs, p);
>  +     }
> 
> 
> when dequeue:
> 
> -       if (!(p->se.sched_delayed && (task_on_rq_migrating(p) ||
> (flags & DEQUEUE_SAVE))))
> +       if (!p->se.sched_delayed) {
> +               uclamp_rq_dec(rq, p);
>                 util_est_dequeue(&rq->cfs, p);
> +       }

So you want to exclude all delayed tasks from util_est and uclamp?

  reply	other threads:[~2025-03-07 18:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-27 13:54 [PATCH] sched/uclamp: Let each sched_class handle uclamp Hongyan Xia
2025-03-05 18:22 ` Dietmar Eggemann
2025-03-06 10:53   ` Hongyan Xia
2025-03-06 13:48     ` Dietmar Eggemann
2025-03-06 14:26       ` Hongyan Xia
2025-03-06 14:40         ` Hongyan Xia
2025-03-06 12:01   ` Xuewen Yan
2025-03-07 18:32     ` Dietmar Eggemann [this message]
2025-03-10  2:41       ` Xuewen Yan
2025-03-10 10:53         ` Dietmar Eggemann
2025-03-10 11:03           ` Xuewen Yan
2025-03-10 11:22             ` Dietmar Eggemann
2025-03-10 11:56               ` Hongyan Xia
2025-03-10 12:24                 ` Dietmar Eggemann
2025-03-11 14:04                   ` Hongyan Xia
2025-03-14  9:19           ` Xuewen Yan
2025-03-06 12:03 ` Xuewen Yan
2025-03-06 12:24   ` Hongyan Xia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf5a70bf-3d13-4b3b-a3ef-804998b21fe9@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=arighi@nvidia.com \
    --cc=bsegall@google.com \
    --cc=changwoo@igalia.com \
    --cc=hongyan.xia2@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=void@manifault.com \
    --cc=vschneid@redhat.com \
    --cc=xuewen.yan94@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox