From: Con Kolivas <kernel@kolivas.org>
To: ck@vds.kolivas.org, Michael Gerdau <mgd@technosis.de>
Cc: Willy Tarreau <w@1wt.eu>, Nick Piggin <npiggin@suse.de>,
Gene Heskett <gene.heskett@gmail.com>,
Al Boldi <a1426z@gawab.com>, Bill Huey <billh@gnuppy.monkey.org>,
Mike Galbraith <efault@gmx.de>,
linux kernel mailing list <linux-kernel@vger.kernel.org>,
William Lee Irwin III <wli@holomorphy.com>,
Peter Williams <pwil3058@bigpond.net.au>,
Matt Mackall <mpm@selenic.com>
Subject: Re: [ck] Re: [ANNOUNCE] Staircase Deadline cpu scheduler version 0.45
Date: Sun, 22 Apr 2007 22:18:32 +1000 [thread overview]
Message-ID: <200704222218.32754.kernel@kolivas.org> (raw)
In-Reply-To: <200704222142.52325.kernel@kolivas.org>
On Sunday 22 April 2007 21:42, Con Kolivas wrote:
Willy I'm still investigating the idle time and fluctuating load as a separate
issue. Is it possible the multiple ocbench processes are naturally
synchronising and desynchronising and choosing to sleep and/or run at the
same time? I can remove the idle time entirely by running ocbench at nice 19
which means they are all forced to run at basically the same time by the
scheduler.
Anyway the more important part is... Can you test this patch please? Dump
all the other patches I sent you post 045. Michael, if you could test too
please?
Thanks!
---
It appears load weight still wasn't being set in enough places and changing
where rr_interval was being set a few iterations of SD ago might have revealed
that bug. Ensure load_weight is set whenever p->quota is set and simplify
dramatically the load_weight.
Signed-off-by: Con Kolivas <kernel@kolivas.org>
---
kernel/sched.c | 35 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)
Index: linux-2.6.21-rc7-sd/kernel/sched.c
===================================================================
--- linux-2.6.21-rc7-sd.orig/kernel/sched.c 2007-04-22 21:37:25.000000000 +1000
+++ linux-2.6.21-rc7-sd/kernel/sched.c 2007-04-22 22:01:48.000000000 +1000
@@ -102,8 +102,6 @@ unsigned long long __attribute__((weak))
*/
int rr_interval __read_mostly = 8;
-#define DEF_TIMESLICE (rr_interval * 20)
-
/*
* This contains a bitmap for each dynamic priority level with empty slots
* for the valid priorities each different nice level can have. It allows
@@ -886,16 +884,10 @@ static int task_timeslice(struct task_st
}
/*
- * Assume: static_prio_timeslice(NICE_TO_PRIO(0)) == DEF_TIMESLICE
- * If static_prio_timeslice() is ever changed to break this assumption then
- * this code will need modification. Scaled as multiples of milliseconds.
- */
-#define TIME_SLICE_NICE_ZERO DEF_TIMESLICE
-#define LOAD_WEIGHT(lp) \
- (((lp) * SCHED_LOAD_SCALE) / TIME_SLICE_NICE_ZERO)
-#define TASK_LOAD_WEIGHT(p) LOAD_WEIGHT(task_timeslice(p))
-#define RTPRIO_TO_LOAD_WEIGHT(rp) \
- (LOAD_WEIGHT((rr_interval + 20 + (rp))))
+ * The load weight is basically the task_timeslice in ms. Realtime tasks are
+ * special cased to be proportionately larger by their rt_priority.
+ */
+#define RTPRIO_TO_LOAD_WEIGHT(rp) ((rr_interval + 20 + (rp)))
static void set_load_weight(struct task_struct *p)
{
@@ -912,7 +904,7 @@ static void set_load_weight(struct task_
#endif
p->load_weight = RTPRIO_TO_LOAD_WEIGHT(p->rt_priority);
} else
- p->load_weight = TASK_LOAD_WEIGHT(p);
+ p->load_weight = task_timeslice(p);
}
static inline void
@@ -995,7 +987,7 @@ static int effective_prio(struct task_st
* nice -20 = 10 * rr_interval. nice 1-19 = rr_interval / 2.
* Value returned is in microseconds.
*/
-static unsigned int rr_quota(struct task_struct *p)
+static inline unsigned int rr_quota(struct task_struct *p)
{
int nice = TASK_NICE(p), rr = rr_interval;
@@ -1009,6 +1001,13 @@ static unsigned int rr_quota(struct task
return MS_TO_US(rr);
}
+/* Every time we set the quota we need to set the load weight */
+static void set_quota(struct task_struct *p)
+{
+ p->quota = rr_quota(p);
+ set_load_weight(p);
+}
+
/*
* activate_task - move a task to the runqueue and do priority recalculation
*/
@@ -1036,7 +1035,7 @@ static void activate_task(struct task_st
(now - p->timestamp) >> 20);
}
- p->quota = rr_quota(p);
+ set_quota(p);
p->prio = effective_prio(p);
p->timestamp = now;
__activate_task(p, rq);
@@ -3885,8 +3884,7 @@ void set_user_nice(struct task_struct *p
p->static_prio = NICE_TO_PRIO(nice);
old_prio = p->prio;
p->prio = effective_prio(p);
- p->quota = rr_quota(p);
- set_load_weight(p);
+ set_quota(p);
delta = p->prio - old_prio;
if (queued) {
@@ -4020,8 +4018,7 @@ static void __setscheduler(struct task_s
p->normal_prio = normal_prio(p);
/* we are holding p->pi_lock already */
p->prio = rt_mutex_getprio(p);
- p->quota = rr_quota(p);
- set_load_weight(p);
+ set_quota(p);
}
/**
--
-ck
next prev parent reply other threads:[~2007-04-22 12:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-22 4:41 [ANNOUNCE] Staircase Deadline cpu scheduler version 0.45 Con Kolivas
2007-04-22 7:00 ` Willy Tarreau
2007-04-22 7:27 ` Con Kolivas
2007-04-22 7:31 ` Con Kolivas
2007-04-22 8:06 ` Willy Tarreau
2007-04-22 8:53 ` Con Kolivas
2007-04-22 9:14 ` Willy Tarreau
2007-04-22 9:53 ` Con Kolivas
2007-04-22 11:42 ` Con Kolivas
2007-04-22 12:18 ` Con Kolivas [this message]
2007-04-22 13:07 ` [ck] " Willy Tarreau
2007-04-22 13:27 ` Con Kolivas
2007-04-22 14:22 ` Willy Tarreau
2007-04-22 14:35 ` Con Kolivas
2007-04-23 7:02 ` Con Kolivas
2007-04-22 14:27 ` Michael Gerdau
2007-04-22 14:37 ` Con Kolivas
2007-04-22 8:02 ` [ck] " Michael Gerdau
2007-04-22 11:09 ` Con Kolivas
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=200704222218.32754.kernel@kolivas.org \
--to=kernel@kolivas.org \
--cc=a1426z@gawab.com \
--cc=billh@gnuppy.monkey.org \
--cc=ck@vds.kolivas.org \
--cc=efault@gmx.de \
--cc=gene.heskett@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgd@technosis.de \
--cc=mpm@selenic.com \
--cc=npiggin@suse.de \
--cc=pwil3058@bigpond.net.au \
--cc=w@1wt.eu \
--cc=wli@holomorphy.com \
/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