[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b31bbfd3-6544-4b47-93b3-abe505b1b49e@amperemail.onmicrosoft.com>
Date: Mon, 1 Dec 2025 10:48:37 +0800
From: Shijie Huang <shijie@...eremail.onmicrosoft.com>
To: Peter Zijlstra <peterz@...radead.org>,
Huang Shijie <shijie@...amperecomputing.com>
Cc: mingo@...hat.com, juri.lelli@...hat.com, vincent.guittot@...aro.org,
patches@...erecomputing.com, cl@...ux.com, Shubhang@...amperecomputing.com,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, linux-kernel@...r.kernel.org, vschneid@...hat.com,
vineethr@...ux.ibm.com, kprateek.nayak@....com
Subject: Re: [PATCH v4 1/2] sched/fair: set rq->idle_stamp at the end of the
sched_balance_newidle
On 28/11/2025 17:31, Peter Zijlstra wrote:
> This changelog tells me what the patch does, something I can see from
> reading the patch itself. However, it completely fails at the purpose of
> a changelog, which is to elucidate the reader as to the reasons for
> doing so.
How about to change the changelog as following:
"
In current newidle balance, the rq->idle_stamp may set to a non-zero value
if it cannot pull any task.
In the wakeup, it will detect the rq->idle_stamp, and updates
the rq->avg_idle, then ends the CPU idle status by setting rq->idle_stamp
to zero.
Besides the wakeup, current code does not end the CPU idle status
when a task is moved to the idle CPU, such as fork/clone, execve,
or other cases.
In order to fix this issue, we want to add a hook(update_rq_avg_idle())
in the enqueue_task(). With this hook, if a task is moved to the idle CPU,
it will update the rq->avg_idle. Unfortunately, this hook is also called
in the newidle balance:
sched_balance_newidle() --> sched_balance_rq() --> ... -->
enqueue_task()
If we still set rq->idle_stamp at the beginning of sched_balance_newidle(),
the rq->avg_idle will not be updated correctly.
In order to make it work correctly, save the idle_stamp at the beginning
of sched_balance_newidle(). If newidle balance cannot pull any task,
set the saved value for rq->idle_stamp. With this method,
the newidle balance still work correctly, and the hook in enqueue_task()
also works correctly.
"
Thanks
Huang Shijie
Powered by blists - more mailing lists