From: Chengming Zhou <zhouchengming@bytedance.com>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
bristot@redhat.com, vschneid@redhat.com, odin@uged.al
Cc: linux-kernel@vger.kernel.org, duanxiongchun@bytedance.com,
songmuchun@bytedance.com,
Chengming Zhou <zhouchengming@bytedance.com>
Subject: [PATCH v2 1/2] sched/fair: fix propagate during synchronous attach/detach
Date: Thu, 26 May 2022 15:13:53 +0800 [thread overview]
Message-ID: <20220526071354.6426-2-zhouchengming@bytedance.com> (raw)
In-Reply-To: <20220526071354.6426-1-zhouchengming@bytedance.com>
When a task moves from/to a cfs_rq, we first detach/attach the load_avg
of se from/to that cfs_rq, then propagate the changes across the tg tree
to make it visible to the root, which did in update_load_avg().
But the current code will break when encountering a on_list cfs_rq,
can't propagate up to the root cfs_rq, that also mismatch with the
comment of propagate_entity_cfs_rq(), which says "Propagate the changes
of the sched_entity across the tg tree to make it visible to the root".
The second problem is that it won't update_load_avg() for throttled
cfs_rq, cause the load changes can't be propagated upwards.
A
|
B --> throttled cfs_rq
/
C
The prop_runnable_sum of C won't be propagated to B, so won't be
propagated to A.
Fixes: 0258bdfaff5b ("sched/fair: Fix unfairness caused by missing load decay")
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
kernel/sched/fair.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 523e548c8fdd..5276d05692e0 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -11303,14 +11303,8 @@ static void propagate_entity_cfs_rq(struct sched_entity *se)
for_each_sched_entity(se) {
cfs_rq = cfs_rq_of(se);
- if (!cfs_rq_throttled(cfs_rq)){
- update_load_avg(cfs_rq, se, UPDATE_TG);
- list_add_leaf_cfs_rq(cfs_rq);
- continue;
- }
-
- if (list_add_leaf_cfs_rq(cfs_rq))
- break;
+ update_load_avg(cfs_rq, se, UPDATE_TG);
+ list_add_leaf_cfs_rq(cfs_rq);
}
}
#else
--
2.36.1
next prev parent reply other threads:[~2022-05-26 7:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-26 7:13 [PATCH v2 0/2] sched/fair: optimize and simplify rq leaf_cfs_rq_list Chengming Zhou
2022-05-26 7:13 ` Chengming Zhou [this message]
2022-05-26 7:13 ` [PATCH v2 2/2] " Chengming Zhou
2022-05-26 8:53 ` kernel test robot
2022-05-26 10:25 ` [External] " Chengming Zhou
2022-05-26 10:46 ` kernel test robot
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=20220526071354.6426-2-zhouchengming@bytedance.com \
--to=zhouchengming@bytedance.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=duanxiongchun@bytedance.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=odin@uged.al \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=songmuchun@bytedance.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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®