From: Josef Bacik <josef@toxicpanda.com>
To: mingo@redhat.com, peterz@infradead.org,
linux-kernel@vger.kernel.org, umgwanakikbuti@gmail.com,
tj@kernel.org, kernel-team@fb.com
Cc: Josef Bacik <jbacik@fb.com>
Subject: [PATCH 2/7] sched/fair: calculate runnable_weight slightly differently
Date: Fri, 14 Jul 2017 13:20:59 +0000 [thread overview]
Message-ID: <1500038464-8742-3-git-send-email-josef@toxicpanda.com> (raw)
In-Reply-To: <1500038464-8742-1-git-send-email-josef@toxicpanda.com>
From: Josef Bacik <jbacik@fb.com>
Our runnable_weight currently looks like this
runnable_weight = shares * runnable_load_avg / load_avg
The goal is to scale the runnable weight for the group based on its runnable to
load_avg ratio. The problem with this is it biases us towards tasks that never
go to sleep. Tasks that go to sleep are going to have their runnable_load_avg
decayed pretty hard, which will drastically reduce the runnable weight of groups
with interactive tasks. To solve this imbalance we tweak this slightly, so in
the ideal case it is still the above, but in the interactive case it is
runnable_weight = shares * runnable_weight / load_weight
which will make the weight distribution fairer between interactive and
non-interactive groups.
Signed-off-by: Josef Bacik <jbacik@fb.com>
---
kernel/sched/fair.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 326bc55..5d4489e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2880,9 +2880,15 @@ static void update_cfs_group(struct sched_entity *se)
* Note: we need to deal with very sporadic 'runnable > load' cases
* due to numerical instability.
*/
- runnable = shares * gcfs_rq->avg.runnable_load_avg;
- if (runnable)
- runnable /= max(gcfs_rq->avg.load_avg, gcfs_rq->avg.runnable_load_avg);
+ runnable = shares * max(scale_load_down(gcfs_rq->runnable_weight),
+ gcfs_rq->avg.runnable_load_avg);
+ if (runnable) {
+ long divider = max(gcfs_rq->avg.load_avg,
+ scale_load_down(gcfs_rq->load.weight));
+ divider = max_t(long, 1, divider);
+ runnable /= divider;
+ }
+ runnable = clamp_t(long, runnable, MIN_SHARES, shares);
reweight_entity(cfs_rq_of(se), se, shares, runnable);
}
--
2.9.3
next prev parent reply other threads:[~2017-07-14 13:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-14 13:20 [PATCH 0/7][RESEND] Fix cpu imbalance with equal weighted groups Josef Bacik
2017-07-14 13:20 ` [PATCH 1/7] sched/fair: use reweight_entity to reweight tasks Josef Bacik
2017-07-31 10:45 ` Peter Zijlstra
2017-07-14 13:20 ` Josef Bacik [this message]
2017-07-31 11:39 ` [PATCH 2/7] sched/fair: calculate runnable_weight slightly differently Peter Zijlstra
2017-07-14 13:21 ` [PATCH 3/7] sched/fair: fix definitions of effective load Josef Bacik
2017-07-14 13:21 ` [PATCH 4/7] sched/fair: don't include effective load of process in the old cpu load Josef Bacik
2017-07-14 13:21 ` [PATCH 5/7] sched/fair: use the task weight instead of average in effective_load Josef Bacik
2017-07-14 13:21 ` [PATCH 6/7] sched/fair: rework effective_load Josef Bacik
2017-07-14 13:21 ` [PATCH 7/7] sched/fair: don't wake affine recently load balanced tasks Josef Bacik
2017-08-01 10:51 ` Brendan Jackman
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=1500038464-8742-3-git-send-email-josef@toxicpanda.com \
--to=josef@toxicpanda.com \
--cc=jbacik@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tj@kernel.org \
--cc=umgwanakikbuti@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®