mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Vincent Donnefort <vincent.donnefort@arm.com>,
	Xuewen Yan <xuewen.yan94@gmail.com>
Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, bristot@redhat.com,
	linux-kernel@vger.kernel.org, zhang.lyra@gmail.com,
	xuewyan@foxmail.com
Subject: Re: [PATCH v2] sched/pelt: Keep UTIL_AVG_UNCHANGED flag in sync when calculating last_enqueued_diff
Date: Fri, 7 May 2021 15:36:47 +0200	[thread overview]
Message-ID: <da0fe50a-f419-e6a1-d67f-76fbe5cbf520@arm.com> (raw)
In-Reply-To: <20210507123528.GA106818@e120877-lin.cambridge.arm.com>

On 07/05/2021 14:35, Vincent Donnefort wrote:
> On Fri, May 07, 2021 at 07:20:31PM +0800, Xuewen Yan wrote:
>> From: Xuewen Yan <xuewen.yan@unisoc.com>
>>
>> Last_enqueued_diff's meaning: "diff = util_est.enqueued(p) - task_util(p)".
>> When calculating last_enqueued_diff, we add UTIL_AVG_UNCHANGED flag, which
>> is the LSB, for task_util, but don't add the flag for util_est.enqueued.
>> However the enqueued's flag had been cleared when the task util changed.
>> As a result, we add +1 to the diff, this is therefore reducing slightly
>> UTIL_EST_MARGIN.
> 
> Unless I miss something it actually depends on the situation, doesn't it?
> 
> if ue.enqueued > task_util(), we remove 1 from the diff => UTIL_EST_MARGIN + 1
> 
> if ue.enqueued < task_util(), we add 1 to the diff => UTIL_EST_MARGIN -1

I get:

ue.enqueued & UTIL_AVG_UNCHANGED = 0

last_enqueued_diff = ue.enqueued_old                    -  ue.enqueued_new

last_enqueued_diff = (ue.enqueued | UTIL_AVG_UNCHANGED) - (task_util(p) | UTIL_AVG_UNCHANGED)

                                   ^^^^^^^^^^^^^^^^^^^^
                                   added by patch


ue.enqueued_old didn't have the flag, otherwise would return earlier

task_util(p) could have the LSB set but we just set it to make sure it's set

So last_enqueued_diff is 1 larger.

But UTIL_EST_MARGIN stays `SCHED_CAPACITY_SCALE / 100` ?

Did I miss something here?

>>
>> Add the flag for util_est.enqueued to have a accurate computation.
>>
>> Fixes: b89997aa88f0b sched/pelt: Fix task util_est update filtering
>>
>> Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
>> ---
>>  kernel/sched/fair.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index e5e457fa9dc8..94d77b4fa601 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -3996,7 +3996,7 @@ static inline void util_est_update(struct cfs_rq *cfs_rq,
>>  	if (ue.enqueued & UTIL_AVG_UNCHANGED)
>>  		return;
>>  
>> -	last_enqueued_diff = ue.enqueued;
>> +	last_enqueued_diff = (ue.enqueued | UTIL_AVG_UNCHANGED);
>>  
>>  	/*
>>  	 * Reset EWMA on utilization increases, the moving average is used only
>> -- 
>> 2.29.0
>>


  reply	other threads:[~2021-05-07 13:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07 11:20 Xuewen Yan
2021-05-07 12:35 ` Vincent Donnefort
2021-05-07 13:36   ` Dietmar Eggemann [this message]
2021-05-07 15:38     ` Vincent Donnefort
2021-05-07 16:39       ` Dietmar Eggemann
2021-05-07 17:14         ` Vincent Donnefort
2021-05-08  1:23           ` Xuewen Yan
2021-05-10  9:27             ` Vincent Donnefort

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=da0fe50a-f419-e6a1-d67f-76fbe5cbf520@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.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=vincent.donnefort@arm.com \
    --cc=vincent.guittot@linaro.org \
    --cc=xuewen.yan94@gmail.com \
    --cc=xuewyan@foxmail.com \
    --cc=zhang.lyra@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

all inboxes | Powered by JetHome®