mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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: [patch] Re: problem with "sched: revert back to per-rq vruntime"?
Date: Thu, 01 Jan 2009 08:46:03 +0100	[thread overview]
Message-ID: <1230795963.5892.14.camel@marge.simson.net> (raw)
In-Reply-To: <495BD346.9040408@jaysonking.com>

Would perhaps be prettier to have the load already in place at call
time, but methinks the enqueue/dequeue accounting logic is nice as is,
so complete the unlikely case handling in an unlikely block.
 
Impact: bug fixlet.

Account for tasks which have not yet been enqueued in calc_delta_weight().

Signed-off-by: Mike Galbraith <efault@gmx.de>

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 5ad4440..4685f28 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -392,8 +392,16 @@ 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);
+		struct load_weight *load = &cfs_rq_of(se)->load;
+
+		if (unlikely(!se->on_rq)) {
+			struct load_weight tmp;
+
+			tmp.weight = load->weight + se->load.weight;
+			tmp.inv_weight = 0;
+			load = &tmp;
+		}
+		delta = calc_delta_mine(delta, se->load.weight, load);
 	}
 
 	return delta;



  reply	other threads:[~2009-01-01  7:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-29 22:02 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       ` Mike Galbraith [this message]
2009-01-02  0:14         ` [patch] " Jayson King
2009-01-02 11:16           ` Mike Galbraith
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=1230795963.5892.14.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome