mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hongyan Xia <hongyan.xia2@arm.com>
To: Christian Loehle <christian.loehle@arm.com>,
	Xuewen Yan <xuewen.yan@unisoc.com>,
	peterz@infradead.org, mingo@redhat.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	Pierre Gondois <pierre.gondois@arm.com>,
	Luis Machado <luis.machado@arm.com>
Cc: rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com, ke.wang@unisoc.com, di.shen@unisoc.com,
	xuewen.yan94@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] sched/fair: Prevent from cpufreq not being updated when delayed-task is iowait
Date: Thu, 27 Feb 2025 13:41:53 +0000	[thread overview]
Message-ID: <c507c4ce-25c8-45d2-ad27-53ade0a58d40@arm.com> (raw)
In-Reply-To: <7e3b656e-ea65-4441-b08f-062eb0501355@arm.com>

On 26/02/2025 12:08, Christian Loehle wrote:
> On 2/26/25 11:43, Xuewen Yan wrote:
>> Because the sched-delayed task maybe in io-wait state,
>> so we should place the requeue_delayed_entity() after the
>> cpufreq_update_util(), to prevent not boosting iowait cpufreq
>> before return.
>>
>> Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
>> ---
>>   kernel/sched/fair.c | 10 +++++-----
>>   1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 2d6d5582c3e9..040674734128 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -6931,11 +6931,6 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
>>   	if (!(p->se.sched_delayed && (task_on_rq_migrating(p) || (flags & ENQUEUE_RESTORE))))
>>   		util_est_enqueue(&rq->cfs, p);
>>   
>> -	if (flags & ENQUEUE_DELAYED) {
>> -		requeue_delayed_entity(se);
>> -		return;
>> -	}
>> -
>>   	/*
>>   	 * If in_iowait is set, the code below may not trigger any cpufreq
>>   	 * utilization updates, so do it here explicitly with the IOWAIT flag
>> @@ -6944,6 +6939,11 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
>>   	if (p->in_iowait)
>>   		cpufreq_update_util(rq, SCHED_CPUFREQ_IOWAIT);
>>   
>> +	if (flags & ENQUEUE_DELAYED) {
>> +		requeue_delayed_entity(se);
>> +		return;
>> +	}
>> +
>>   	if (task_new && se->sched_delayed)
>>   		h_nr_runnable = 0;
>>   
> 
> I understand that iowait cpufreq update isn't happening now (and that's a bug),
> but if we reorder we may call cpufreq_update_util(rq, SCHED_CPUFREQ_IOWAIT)
> followed by the cpufreq_update_util() in update_load_avg() of
> requeue_delayed_entity()
> 	update_load_avg()
> 		cpufreq_update_util()
> 
> and the latter will likely be dropped by the governor, so the update
> won't include util of the (re)-enqueuing task, right?
> 
> I'll give it some more thought.

True, but I think the code was like this before anyway. On the 
non-delayed path, the problem you mentioned still exists. Not saying 
this is the right thing, but just saying this is what it has always been 
like.

      parent reply	other threads:[~2025-02-27 13:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 11:43 Xuewen Yan
2025-02-26 12:08 ` Christian Loehle
2025-02-27  2:12   ` Xuewen Yan
2025-02-27 13:41   ` Hongyan Xia [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=c507c4ce-25c8-45d2-ad27-53ade0a58d40@arm.com \
    --to=hongyan.xia2@arm.com \
    --cc=bsegall@google.com \
    --cc=christian.loehle@arm.com \
    --cc=di.shen@unisoc.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=ke.wang@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luis.machado@arm.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pierre.gondois@arm.com \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --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

all inboxes | Powered by JetHome®