From: Namhyung Kim <namhyung@kernel.org>
To: Ingo Molnar <mingo@kernel.org>, Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: LKML <linux-kernel@vger.kernel.org>,
Alex Shi <alex.shi@intel.com>,
Preeti U Murthy <preeti@linux.vnet.ibm.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Namhyung Kim <namhyung.kim@lge.com>, Paul Turner <pjt@google.com>
Subject: [PATCH] sched: Fix calc_cfs_shares() to consider blocked_load_avg also
Date: Thu, 28 Feb 2013 15:26:02 +0900 [thread overview]
Message-ID: <1362032762-20827-1-git-send-email-namhyung@kernel.org> (raw)
From: Namhyung Kim <namhyung.kim@lge.com>
The calc_tg_weight() and calc_cfs_shares() used cfs_rq->load.weight
but this is no longer valid for per-entity load tracking since
cfs_rq->tg_load_contrib consists of runnable_load_avg and blocked_
load_avg. Simply using load.weight here will lose blocked_load_avg
part so will result in an inaccurate share.
Cc: Paul Turner <pjt@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
kernel/sched/fair.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 7a33e5986fc5..add7440bd02f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1032,13 +1032,13 @@ static inline long calc_tg_weight(struct task_group *tg, struct cfs_rq *cfs_rq)
long tg_weight;
/*
- * Use this CPU's actual weight instead of the last load_contribution
- * to gain a more accurate current total weight. See
- * update_cfs_rq_load_contribution().
+ * Use this CPU's actual load instead of the last load_contribution
+ * to gain a more accurate current total load. See
+ * __update_cfs_rq_tg_load_contrib().
*/
tg_weight = atomic64_read(&tg->load_avg);
tg_weight -= cfs_rq->tg_load_contrib;
- tg_weight += cfs_rq->load.weight;
+ tg_weight += cfs_rq->runnable_load_avg + cfs_rq->blocked_load_avg;
return tg_weight;
}
@@ -1048,7 +1048,7 @@ static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg)
long tg_weight, load, shares;
tg_weight = calc_tg_weight(tg, cfs_rq);
- load = cfs_rq->load.weight;
+ load = cfs_rq->runnable_load_avg + cfs_rq->blocked_load_avg;
shares = (tg->shares * load);
if (tg_weight)
--
1.7.11.7
next reply other threads:[~2013-02-28 6:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-28 6:26 Namhyung Kim [this message]
2013-03-04 9:13 ` [PATCH] sched: Fix calc_cfs_shares() to consider blocked_load_avg also Paul Turner
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=1362032762-20827-1-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=alex.shi@intel.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
--cc=pjt@google.com \
--cc=preeti@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).