From: Mike Galbraith <efault@gmx.de>
To: Jayson King <dev@jaysonking.com>
Cc: linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, mingo@elte.hu
Subject: Re: [patch] Re: problem with "sched: revert back to per-rq vruntime"?
Date: Fri, 02 Jan 2009 12:16:42 +0100 [thread overview]
Message-ID: <1230895002.5747.46.camel@marge.simson.net> (raw)
In-Reply-To: <495D5C70.4090804@jaysonking.com>
On Thu, 2009-01-01 at 18:14 -0600, Jayson King wrote:
> Still works OK for me. You may add, if you like:
>
> Tested-By: Jayson King <dev@jaysonking.com>
Actually, I prefer the below. Everything in one spot and obvious.
Impact: bug fixlet.
Fix sched_slice() to emit a sane result whether a task is currently enqueued or not.
Signed-off-by: Mike Galbraith <efault@gmx.de>
kernel/sched_fair.c | 30 ++++++++++++------------------
1 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 5ad4440..1a35bad 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -386,20 +386,6 @@ int sched_nr_latency_handler(struct ctl_table *table, int write,
#endif
/*
- * delta *= P[w / rw]
- */
-static inline unsigned long
-calc_delta_weight(unsigned long delta, struct sched_entity *se)
-{
- for_each_sched_entity(se) {
- delta = calc_delta_mine(delta,
- se->load.weight, &cfs_rq_of(se)->load);
- }
-
- return delta;
-}
-
-/*
* delta /= w
*/
static inline unsigned long
@@ -440,12 +426,20 @@ static u64 __sched_period(unsigned long nr_running)
*/
static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
{
- unsigned long nr_running = cfs_rq->nr_running;
+ u64 slice = __sched_period(cfs_rq->nr_running + !se->on_rq);
+
+ for_each_sched_entity(se) {
+ struct load_weight *load = &cfs_rq->load;
- if (unlikely(!se->on_rq))
- nr_running++;
+ if (unlikely(!se->on_rq)) {
+ struct load_weight lw = cfs_rq->load;
- return calc_delta_weight(__sched_period(nr_running), se);
+ update_load_add(&lw, se->load.weight);
+ load = &lw;
+ }
+ slice = calc_delta_mine(slice, se->load.weight, load);
+ }
+ return slice;
}
/*
next prev parent reply other threads:[~2009-01-02 11:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-29 22:02 problem with "sched: revert back to per-rq vruntime"? Jayson King
2008-12-29 22:11 ` Jayson King
2008-12-30 19:37 ` Jayson King
2008-12-31 16:26 ` Mike Galbraith
2008-12-31 20:17 ` Jayson King
2009-01-01 7:46 ` [patch] " Mike Galbraith
2009-01-02 0:14 ` Jayson King
2009-01-02 11:16 ` Mike Galbraith [this message]
2009-01-02 20:38 ` Jayson King
2009-01-05 7:54 ` Peter Zijlstra
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=1230895002.5747.46.camel@marge.simson.net \
--to=efault@gmx.de \
--cc=a.p.zijlstra@chello.nl \
--cc=dev@jaysonking.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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.