From: Con Kolivas <kernel@kolivas.org>
To: Michael Buesch <mbuesch@freenet.de>
Cc: linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Staircase scheduler v7.4
Date: Sun, 27 Jun 2004 22:00:12 +1000 [thread overview]
Message-ID: <40DEB6CC.4030208@kolivas.org> (raw)
In-Reply-To: <200406252148.37606.mbuesch@freenet.de>
[-- Attachment #1.1: Type: text/plain, Size: 313 bytes --]
Here is an incremental patch from 2.6.7-staircase7.4 (without any later
changes) to staircase7.6 which I hope addresses your problem of no
timeslice tasks. Can you try it please? Sorry about the previous noise.
Con
P.S.
Those with ck kernels I'm about to post another diff for -ck addressing
the same thing.
[-- Attachment #1.2: from_2.6.7-staircase7.4_to_staircase7.6 --]
[-- Type: text/x-troff-man, Size: 3610 bytes --]
Index: linux-2.6.7-ck2pre/kernel/sched.c
===================================================================
--- linux-2.6.7-ck2pre.orig/kernel/sched.c 2004-06-25 23:06:57.000000000 +1000
+++ linux-2.6.7-ck2pre/kernel/sched.c 2004-06-27 21:39:40.182630568 +1000
@@ -231,8 +231,8 @@
static void enqueue_task(struct task_struct *p, runqueue_t *rq)
{
- if (rq->curr->flags & PF_PREEMPTED) {
- rq->curr->flags &= ~PF_PREEMPTED;
+ if (p->flags & PF_PREEMPTED) {
+ p->flags &= ~PF_PREEMPTED;
list_add(&p->run_list, rq->queue + p->prio);
} else
list_add_tail(&p->run_list, rq->queue + p->prio);
@@ -268,7 +268,10 @@
rq->nr_running++;
}
-// burst - extra intervals an interactive task can run for at best priority
+/*
+ * burst - extra intervals an interactive task can run for at best priority
+ * instead of descending priorities.
+ */
static unsigned int burst(task_t *p)
{
unsigned int task_user_prio;
@@ -297,7 +300,10 @@
p->burst--;
}
-// slice - the duration a task runs before losing burst
+/*
+ * slice - the duration a task runs before getting requeued at it's best
+ * priority and has it's burst decremented.
+ */
static unsigned int slice(task_t *p)
{
unsigned int slice = RR_INTERVAL;
@@ -308,7 +314,9 @@
return slice;
}
-// interactive - interactive tasks get longer intervals at best priority
+/*
+ * interactive - sysctl which allows interactive tasks to have bursts
+ */
int interactive = 1;
/*
@@ -346,20 +354,25 @@
return prio;
}
+/*
+ * recalc_task_prio - this checks for tasks that run ultra short timeslices
+ * or have just forked a thread/process and make them continue their old
+ * slice instead of starting a new one at high priority.
+ */
static void recalc_task_prio(task_t *p, unsigned long long now)
{
unsigned long sleep_time = now - p->timestamp;
- unsigned long run_time = NS_TO_JIFFIES(p->runtime);
- unsigned long total_run = NS_TO_JIFFIES(p->totalrun) + run_time;
- if ((!run_time && NS_TO_JIFFIES(p->runtime + sleep_time) <
- rr_interval(p)) || p->flags & PF_FORKED) {
+ unsigned long ns_totalrun = p->totalrun + p->runtime;
+ unsigned long total_run = NS_TO_JIFFIES(ns_totalrun);
+ if (p->flags & PF_FORKED || (!(NS_TO_JIFFIES(p->runtime)) &&
+ NS_TO_JIFFIES(p->runtime + sleep_time) < rr_interval(p))) {
p->flags &= ~PF_FORKED;
if (p->slice - total_run < 1) {
p->totalrun = 0;
dec_burst(p);
} else {
- p->totalrun += p->runtime;
- p->slice -= NS_TO_JIFFIES(p->totalrun);
+ p->totalrun = ns_totalrun;
+ p->slice -= total_run;
}
} else {
inc_burst(p);
@@ -786,7 +799,9 @@
unsigned long flags;
runqueue_t *rq = task_rq_lock(current, &flags);
- //Forked process gets no burst to prevent fork bombs.
+ /*
+ * Forked process gets no burst to prevent fork bombs.
+ */
p->burst = 0;
BUG_ON(p->state != TASK_RUNNING);
@@ -1768,11 +1783,15 @@
cpustat->system += sys_ticks;
spin_lock(&rq->lock);
- // SCHED_FIFO tasks never run out of timeslice.
+ /*
+ * SCHED_FIFO tasks never run out of timeslice.
+ */
if (unlikely(p->policy == SCHED_FIFO))
goto out_unlock;
rq->cache_ticks++;
- // Tasks lose burst each time they use up a full slice().
+ /*
+ * Tasks lose burst each time they use up a full slice().
+ */
if (!--p->slice) {
set_tsk_need_resched(p);
dequeue_task(p, rq);
@@ -3601,7 +3620,9 @@
for (j = 0; j <= MAX_PRIO; j++)
INIT_LIST_HEAD(&rq->queue[j]);
memset(rq->bitmap, 0, BITS_TO_LONGS(MAX_PRIO+1)*sizeof(long));
- // delimiter for bitsearch
+ /*
+ * delimiter for bitsearch
+ */
__set_bit(MAX_PRIO, rq->bitmap);
}
/*
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]
next prev parent reply other threads:[~2004-06-27 12:00 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-25 16:40 [PATCH] Staircase scheduler v7.4 Michael Buesch
2004-06-25 16:46 ` Con Kolivas
2004-06-25 18:44 ` Michael Buesch
2004-06-25 19:05 ` Willy Tarreau
2004-06-25 19:48 ` Michael Buesch
2004-06-26 1:11 ` kernel
2004-06-26 16:33 ` Michael Buesch
2004-06-26 17:29 ` Michael Buesch
2004-06-27 9:14 ` Con Kolivas
2004-06-27 19:17 ` Felipe Alfaro Solana
2004-06-27 19:28 ` Michael Buesch
2004-06-27 21:55 ` Felipe Alfaro Solana
2004-06-28 0:15 ` Con Kolivas
2004-06-28 8:40 ` Felipe Alfaro Solana
2004-06-28 8:49 ` Nick Piggin
2004-06-28 11:53 ` Felipe Alfaro Solana
2004-06-28 12:11 ` Con Kolivas
2004-06-28 15:03 ` Oswald Buddenhagen
2004-06-28 15:19 ` Con Kolivas
2004-06-28 15:39 ` Oswald Buddenhagen
2004-06-28 17:11 ` Felipe Alfaro Solana
2004-06-29 4:36 ` Nick Piggin
2004-06-28 23:21 ` Peter Williams
2004-06-29 4:44 ` Nick Piggin
2004-06-29 6:01 ` Ed Sweetman
2004-06-29 6:55 ` Nick Piggin
2004-06-26 2:05 ` Con Kolivas
2004-06-27 10:24 ` Con Kolivas
2004-06-27 10:27 ` Con Kolivas
2004-06-27 23:50 ` Peter Williams
2004-06-27 12:00 ` Con Kolivas [this message]
2004-06-27 12:04 ` Con Kolivas
2004-06-27 12:54 ` Michael Buesch
2004-06-27 13:15 ` Con Kolivas
2004-06-25 16:46 ` Michael Buesch
-- strict thread matches above, loose matches on Subject: below --
2004-06-25 14:38 Con Kolivas
2004-06-25 18:32 ` Matthias Urlichs
2004-06-26 1:28 ` Con Kolivas
2004-06-25 22:20 ` Willy Tarreau
2004-06-26 1:05 ` kernel
2004-06-26 20:04 ` Wes Janzen
2004-06-26 20:11 ` Michael Buesch
2004-06-26 21:14 ` Wes Janzen
2004-06-26 21:38 ` Prakash K. Cheemplavam
2004-06-27 9:16 ` Con Kolivas
2004-06-27 11:40 ` Grzegorz Kulewski
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=40DEB6CC.4030208@kolivas.org \
--to=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mbuesch@freenet.de \
/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