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>,
	peterz@infradead.org, mingo@redhat.com,
	vincent.guittot@linaro.org
Cc: linux-kernel@vger.kernel.org, morten.rasmussen@arm.com,
	chris.redpath@arm.com, qperret@google.com
Subject: Re: [PATCH v3 2/7] sched/fair: Decay task PELT values during migration
Date: Mon, 21 Mar 2022 18:23:37 +0100	[thread overview]
Message-ID: <710b460f-20b9-21c4-3077-8cea35600550@arm.com> (raw)
In-Reply-To: <20220308181957.280354-3-vincent.donnefort@arm.com>

On 08/03/2022 19:19, Vincent Donnefort wrote:

Patch header:

s/during migration/during wakeup migration ?

To make sure it's not related to lb migration (TASK_ON_RQ_MIGRATING).

[...]

> Neither clock_task, clock_pelt nor clock can be accessed without the
> runqueue lock. The new cfs_rq last_update_lag is therefore created and
> encode those three values when the last_update_time value for that very

s/encode/encodes ... It's not really encoding?

[...]

> Now we have an estimation for A + B, we can create an estimator for the
> PELT value at the time of the migration. We need for this purpose to
> inject last_update_time which is a combination of both clock_pelt and
> lost_idle_time. The latter is a time value which is completely lost form a

s/form/from

> PELT point of view and must be ignored. And finally, we can write:
> 
>   rq_clock_pelt_estimator() = last_update_time + A + B
>                             = last_update_time +
>                                    sched_clock_cpu() - last_update_lag

rq_clock_pelt_estimator() did exist in v2 but does not in v3 anymore.
Might be misleading when people search for it.

[...]

> @@ -3688,6 +3704,7 @@ update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq)
>  			   cfs_rq->last_update_time_copy,
>  			   sa->last_update_time);
>  #endif
> +	update_cfs_rq_lag(cfs_rq);
>  
>  	return decayed;
>  }
> @@ -6852,6 +6869,44 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags)
>  
>  static void detach_entity_cfs_rq(struct sched_entity *se);
>  
> +#ifdef CONFIG_NO_HZ_COMMON

Couldn't you put update_cfs_rq_lag() and migrate_se_pelt_lag() under one
CONFIG_NO_HZ_COMMON?

> +static inline void migrate_se_pelt_lag(struct sched_entity *se)

[...]

> +	/*
> +	 * The lag estimation comes with a cost we don't want to pay all the
> +	 * time. Hence, limiting to the case where the source CPU is idle and
> +	 * we know we are at the greatest risk to have an outdated clock.
> +	 */
> +	if (!is_idle)
> +		return;
> +
> +	last_update_lag = u64_u32_load(cfs_rq->last_update_lag);

So each taskgroup has its own last_update_lag. I guess it works since we
sync se in migrate_task_rq_fair() -> remove_entity_load_avg() ->
sync_entity_load_avg() with its cfs_rq.

[...]

> @@ -6859,6 +6914,9 @@ static void detach_entity_cfs_rq(struct sched_entity *se);
>   */
>  static void migrate_task_rq_fair(struct task_struct *p, int new_cpu)
>  {
> +	struct sched_entity *se = &p->se;
> +	struct cfs_rq *cfs_rq = cfs_rq_of(se);

This line can stay in the if condition below since cfs_rq is only used
there. The brackets are also still there (A).

[...]

> @@ -6866,8 +6924,6 @@ static void migrate_task_rq_fair(struct task_struct *p, int new_cpu)
>  	 * the task on the new runqueue.
>  	 */
>  	if (READ_ONCE(p->__state) == TASK_WAKING) {
> -		struct sched_entity *se = &p->se;         <--- (A)
> -		struct cfs_rq *cfs_rq = cfs_rq_of(se);

[...]

  reply	other threads:[~2022-03-21 17:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 18:19 [PATCH v3 0/7] feec() energy margin removal Vincent Donnefort
2022-03-08 18:19 ` [PATCH v3 1/7] sched/fair: Provide u64 read for 32-bits arch helper Vincent Donnefort
2022-03-08 18:19 ` [PATCH v3 2/7] sched/fair: Decay task PELT values during migration Vincent Donnefort
2022-03-21 17:23   ` Dietmar Eggemann [this message]
2022-03-08 18:19 ` [PATCH v3 3/7] sched, drivers: Remove max param from effective_cpu_util()/sched_cpu_util() Vincent Donnefort
2022-03-08 18:19 ` [PATCH v3 4/7] sched/fair: Rename select_idle_mask to select_rq_mask Vincent Donnefort
2022-03-08 18:19 ` [PATCH v3 5/7] sched/fair: Use the same cpumask per-PD throughout find_energy_efficient_cpu() Vincent Donnefort
2022-03-08 18:19 ` [PATCH v3 6/7] sched/fair: Remove task_util from effective utilization in feec() Vincent Donnefort
2022-03-22  9:25   ` Dietmar Eggemann
2022-03-08 18:19 ` [PATCH v3 7/7] sched/fair: Remove the energy margin " Vincent Donnefort
2022-03-22  9:37   ` Dietmar Eggemann

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=710b460f-20b9-21c4-3077-8cea35600550@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=chris.redpath@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=morten.rasmussen@arm.com \
    --cc=peterz@infradead.org \
    --cc=qperret@google.com \
    --cc=vincent.donnefort@arm.com \
    --cc=vincent.guittot@linaro.org \
    /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®