From: Peter Zijlstra <peterz@infradead.org>
To: Chengming Zhou <zhouchengming@bytedance.com>
Cc: vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
mingo@redhat.com, rostedt@goodmis.org, bsegall@google.com,
vschneid@redhat.com, linux-kernel@vger.kernel.org, tj@kernel.org
Subject: Re: [PATCH v5 8/9] sched/fair: defer task sched_avg attach to enqueue_entity()
Date: Thu, 18 Aug 2022 12:39:34 +0200 [thread overview]
Message-ID: <Yv4W5u4+CXir3bjZ@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20220818034343.87625-9-zhouchengming@bytedance.com>
On Thu, Aug 18, 2022 at 11:43:42AM +0800, Chengming Zhou wrote:
> When wake_up_new_task(), we would use post_init_entity_util_avg()
> to init util_avg/runnable_avg based on cpu's util_avg at that time,
> then attach task sched_avg to cfs_rq.
>
> Since enqueue_entity() would always attach any unattached task entity,
> so we can defer this work to enqueue_entity().
>
> post_init_entity_util_avg(p)
> attach_entity_cfs_rq() --> (1)
> activate_task(rq, p)
> enqueue_task() := enqueue_task_fair()
> enqueue_entity()
> update_load_avg(cfs_rq, se, UPDATE_TG | DO_ATTACH)
> if (!se->avg.last_update_time && (flags & DO_ATTACH))
> attach_entity_load_avg() --> (2)
>
> This patch defer attach from (1) to (2)
>
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
> ---
> kernel/sched/fair.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index e0d34ecdabae..aacf38a72714 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -799,8 +799,6 @@ void init_entity_runnable_average(struct sched_entity *se)
> /* when this task enqueue'ed, it will contribute to its cfs_rq's load_avg */
> }
>
> -static void attach_entity_cfs_rq(struct sched_entity *se);
> -
> /*
> * With new tasks being created, their initial util_avgs are extrapolated
> * based on the cfs_rq's current util_avg:
> @@ -863,8 +861,6 @@ void post_init_entity_util_avg(struct task_struct *p)
> se->avg.last_update_time = cfs_rq_clock_pelt(cfs_rq);
> return;
> }
> -
> - attach_entity_cfs_rq(se);
> }
There are comments with update_cfs_rq_load_avg() and
remove_entity_load_avg() that seem to rely on post_init_entity_util()
doing this attach.
If that is no longer true; at the very least those comments need to be
updated, but also, I don't immediately see why that's no longer the
case, so please explain.
next prev parent reply other threads:[~2022-08-18 10:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 3:43 [PATCH v5 0/9] sched/fair: task load tracking optimization and cleanup Chengming Zhou
2022-08-18 3:43 ` [PATCH v5 1/9] sched/fair: maintain task se depth in set_task_rq() Chengming Zhou
2022-08-18 3:43 ` [PATCH v5 2/9] sched/fair: remove redundant cpu_cgrp_subsys->fork() Chengming Zhou
2022-08-18 3:43 ` [PATCH v5 3/9] sched/fair: reset sched_avg last_update_time before set_task_rq() Chengming Zhou
2022-08-18 3:43 ` [PATCH v5 4/9] sched/fair: update comments in enqueue/dequeue_entity() Chengming Zhou
2022-08-18 3:43 ` [PATCH v5 5/9] sched/fair: combine detach into dequeue when migrating task Chengming Zhou
2022-08-18 3:43 ` [PATCH v5 6/9] sched/fair: fix another detach on unattached task corner case Chengming Zhou
2022-08-18 3:43 ` [PATCH v5 7/9] sched/fair: allow changing cgroup of new forked task Chengming Zhou
2022-08-18 10:36 ` Peter Zijlstra
2022-08-18 10:48 ` Chengming Zhou
2022-08-18 3:43 ` [PATCH v5 8/9] sched/fair: defer task sched_avg attach to enqueue_entity() Chengming Zhou
2022-08-18 10:39 ` Peter Zijlstra [this message]
2022-08-18 11:03 ` Chengming Zhou
2022-08-18 3:43 ` [PATCH v5 9/9] sched/fair: don't init util/runnable_avg for !fair task Chengming Zhou
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=Yv4W5u4+CXir3bjZ@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=zhouchengming@bytedance.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.