LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ingo Molnar <mingo@elte.hu>,
	Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>,
	Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 2/2] sched: fair: fix calc_delta_asym
Date: Fri, 15 Feb 2008 12:18:22 +0100	[thread overview]
Message-ID: <20080215112055.831528000@chello.nl> (raw)
In-Reply-To: <20080215111819.978881000@chello.nl>

[-- Attachment #1: sched-fair-asym.patch --]
[-- Type: text/plain, Size: 1132 bytes --]

The goal of calc_delta_asym() is to be asymetrically around NICE_0_LOAD, in
that it favours >=0 over <0. The current implementation does not achieve that.

 -20         |
             |
   0 --------+-------
           .'
  19     .'

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 kernel/sched_fair.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Index: linux-2.6/kernel/sched_fair.c
===================================================================
--- linux-2.6.orig/kernel/sched_fair.c
+++ linux-2.6/kernel/sched_fair.c
@@ -417,12 +417,17 @@ calc_delta_fair(unsigned long delta, str
 static inline unsigned long
 calc_delta_asym(unsigned long delta, struct sched_entity *se)
 {
-	unsigned long fair = calc_delta_fair(delta, se);
+	if (se->load.weight < NICE_0_LOAD) {
+		struct load_weight lw = {
+			.weight = NICE_0_LOAD,
+			.inv_weight = 1UL << (WMULT_SHIFT-NICE_0_SHIFT)
+		};
 
-	if (fair > delta)
-		fair = delta;
+		delta = calc_delta_mine(delta, cfs_rq_of(se)->load.weight, &lw);
+		se = parent_entity(se);
+	}
 
-	return fair;
+	return calc_delta_fair(delta, se);
 }
 
 /*

--


  parent reply	other threads:[~2008-02-15 11:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-15 11:18 [PATCH 0/2] for sched-devel.git Peter Zijlstra
2008-02-15 11:18 ` [PATCH 1/2] sched: fair: virtual deadline scheduling Peter Zijlstra
2008-02-15 11:18 ` Peter Zijlstra [this message]
2008-02-17 16:35 ` [PATCH 0/2] for sched-devel.git Ingo Molnar

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=20080215112055.831528000@chello.nl \
    --to=a.p.zijlstra@chello.nl \
    --cc=dhaval@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=vatsa@linux.vnet.ibm.com \
    --subject='Re: [PATCH 2/2] sched: fair: fix calc_delta_asym' \
    /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

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).