From: tip-bot for Dietmar Eggemann <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, dietmar.eggemann@arm.com, pjt@kernel.org,
hpa@zytor.com, efault@gmx.de, samuel.thibault@ens-lyon.org,
mingo@kernel.org, torvalds@linux-foundation.org,
linux-kernel@vger.kernel.org, peterz@infradead.org
Subject: [tip:sched/core] sched/fair: Explain why MIN_SHARES isn't scaled in calc_cfs_shares()
Date: Sat, 14 Jan 2017 04:48:52 -0800 [thread overview]
Message-ID: <tip-b8fd8423697b9ec729c5bb91737faad84ae19985@git.kernel.org> (raw)
In-Reply-To: <e9a4d858-bcf3-36b9-e3a9-449953e34569@arm.com>
Commit-ID: b8fd8423697b9ec729c5bb91737faad84ae19985
Gitweb: http://git.kernel.org/tip/b8fd8423697b9ec729c5bb91737faad84ae19985
Author: Dietmar Eggemann <dietmar.eggemann@arm.com>
AuthorDate: Wed, 11 Jan 2017 11:29:47 +0000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 14 Jan 2017 11:30:02 +0100
sched/fair: Explain why MIN_SHARES isn't scaled in calc_cfs_shares()
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Turner <pjt@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/e9a4d858-bcf3-36b9-e3a9-449953e34569@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/fair.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 2b866a2..274c747 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2657,6 +2657,18 @@ static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg)
if (tg_weight)
shares /= tg_weight;
+ /*
+ * MIN_SHARES has to be unscaled here to support per-CPU partitioning
+ * of a group with small tg->shares value. It is a floor value which is
+ * assigned as a minimum load.weight to the sched_entity representing
+ * the group on a CPU.
+ *
+ * E.g. on 64-bit for a group with tg->shares of scale_load(15)=15*1024
+ * on an 8-core system with 8 tasks each runnable on one CPU shares has
+ * to be 15*1024*1/8=1920 instead of scale_load(MIN_SHARES)=2*1024. In
+ * case no task is runnable on a CPU MIN_SHARES=2 should be returned
+ * instead of 0.
+ */
if (shares < MIN_SHARES)
shares = MIN_SHARES;
if (shares > tg->shares)
next prev parent reply other threads:[~2017-01-14 12:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-19 22:40 [PATCH] sched/fair: fix calc_cfs_shares fixed point arithmetics Samuel Thibault
2016-12-19 22:44 ` Paul Turner
2016-12-19 23:07 ` Samuel Thibault
2016-12-19 23:26 ` Paul Turner
2016-12-19 23:29 ` Samuel Thibault
2016-12-19 23:32 ` Paul Turner
2016-12-19 23:45 ` Samuel Thibault
2016-12-20 13:04 ` Dietmar Eggemann
2016-12-20 13:15 ` Peter Zijlstra
2017-01-11 11:29 ` Dietmar Eggemann
2017-01-14 12:48 ` tip-bot for Dietmar Eggemann [this message]
2016-12-20 13:22 ` Samuel Thibault
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=tip-b8fd8423697b9ec729c5bb91737faad84ae19985@git.kernel.org \
--to=tipbot@zytor.com \
--cc=dietmar.eggemann@arm.com \
--cc=efault@gmx.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=pjt@kernel.org \
--cc=samuel.thibault@ens-lyon.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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 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.