The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Hongyan Xia <hongyan.xia2@arm.com>,
	Xuewen Yan <xuewen.yan@unisoc.com>,
	vincent.guittot@linaro.org, mingo@redhat.com,
	peterz@infradead.org, juri.lelli@redhat.com
Cc: rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.co, linux-kernel@vger.kernel.org,
	qyousef@layalina.io, ke.wang@unisoc.com, di.shen@unisoc.com,
	xuewen.yan94@gmail.com
Subject: Re: [RFC PATCH] sched/util_est: Do not sub the delayed-task's util-est
Date: Wed, 16 Apr 2025 12:55:44 +0200	[thread overview]
Message-ID: <d71b49d3-78a0-44c6-bac8-2619f8d0c4f0@arm.com> (raw)
In-Reply-To: <be0cace9-d173-4de3-959e-861876ad77fc@arm.com>

On 14/04/2025 15:39, Hongyan Xia wrote:
> On 14/03/2025 09:09, Xuewen Yan wrote:
>> In cpu_util_without, When the task is in rq, we should
>> sub the task's util_est, however, the delayed_task->on_rq
>> is true, however, the delayed_task's util had been sub
>> when sleep, so there is no need to sub the delayed task's
>> util-est. So add the checking of delayed-task.
>>
>> On the other hand, as said in [1], the logic of util_est's
>> enqueue/dequeue could be simplified.
>> So simplify it by aligning with the conditions of uclamp.
>>
>> [1]https://lore.kernel.org/all/CAB8ipk8pEvOtCm-d0o1rsekwxPWUHk9iBGtt9TLTWW-iWTQKiA@mail.gmail.com/
>>
>> Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
>> ---
>>   kernel/sched/fair.c | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index c798d2795243..bebf40a0fa4e 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -6930,7 +6930,7 @@ 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 || (flags & ENQUEUE_DELAYED))
>>           util_est_enqueue(&rq->cfs, p);
>>         if (flags & ENQUEUE_DELAYED) {
>> @@ -7168,7 +7168,7 @@ static int dequeue_entities(struct rq *rq,
>> struct sched_entity *se, int flags)
>>    */
>>   static bool dequeue_task_fair(struct rq *rq, struct task_struct *p,
>> int flags)
>>   {
>> -    if (!(p->se.sched_delayed && (task_on_rq_migrating(p) || (flags &
>> DEQUEUE_SAVE))))
>> +    if (!p->se.sched_delayed)
>>           util_est_dequeue(&rq->cfs, p);
>>         util_est_update(&rq->cfs, p, flags & DEQUEUE_SLEEP);
>> @@ -8037,7 +8037,8 @@ cpu_util(int cpu, struct task_struct *p, int
>> dst_cpu, int boost)
>>            */
>>           if (dst_cpu == cpu)
>>               util_est += _task_util_est(p);
>> -        else if (p && unlikely(task_on_rq_queued(p) || current == p))
>> +        else if (p && unlikely(current == p ||
>> +             (task_on_rq_queued(p) && !p->se.sched_delayed)))
>>               lsub_positive(&util_est, _task_util_est(p));
>>             util = max(util, util_est);
> 
> Tested this patch on several workloads and added util_est warnings. No
> util_est overflow or underflow warnings were seen.
> 
> Tested-by: Hongyan Xia <hongyan.xia2@arm.com>

Just to make sure, does this 'Tested-by' also apply to the current v2
version of this patch?

https://lkml.kernel.org/r/20250325014733.18405-1-xuewen.yan@unisoc.com

In this case Xuewen should apply it on his next version.




      reply	other threads:[~2025-04-16 10:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14  9:09 [RFC PATCH] sched/util_est: Do not sub the delayed-task's util-est Xuewen Yan
2025-03-14 13:14 ` Hongyan Xia
2025-03-21  6:33   ` Xuewen Yan
2025-03-19 13:32 ` Dietmar Eggemann
2025-03-21  6:44   ` Xuewen Yan
2025-03-24 12:10     ` Hongyan Xia
2025-03-24 13:22     ` Dietmar Eggemann
2025-04-14 13:39 ` Hongyan Xia
2025-04-16 10:55   ` Dietmar Eggemann [this message]

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=d71b49d3-78a0-44c6-bac8-2619f8d0c4f0@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=bsegall@google.com \
    --cc=di.shen@unisoc.com \
    --cc=hongyan.xia2@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=ke.wang@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=qyousef@layalina.io \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.co \
    --cc=xuewen.yan94@gmail.com \
    --cc=xuewen.yan@unisoc.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