From: Con Kolivas <kernel@kolivas.org>
To: linux kernel mailing list <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, Mike Galbraith <efault@gmx.de>,
Davide Libenzi <davidel@xmailserver.org>
Subject: [PATCH] O7int for interactivity
Date: Sat, 19 Jul 2003 02:10:49 +1000 [thread overview]
Message-ID: <200307190210.49687.kernel@kolivas.org> (raw)
Here is an update to my Oint patches for 2.5/6 interactivity. Note I will be
away for a week so bash away and abuse this one lots and when I get back I can
see what else needs doing. Note I posted a preview earlier but this is the formal
O7 patch (check the datestamp which people hate in the naming of my patches).
I know this is turning into a marathon effort but... as you're all probably aware
there is nothing simple about tuning this beast. Thanks to all the testers and
people commenting; keep it coming please.
Changes in this patch:
The sleep buffer has been removed yet again. To smooth out X is just not
enough reason for this to be here as it can induce unfairness elsewhere, and
the actual size necessary for the sleep buffer to work nicely would depend on
the hardware.
Kernel threads are excluded from the idle detection code so they can become
max interactive regardless of how long they sleep. Should prevent some of
the bugs seen recently.
The requeuing has been rewritten. User threads will be requeued inversely
proportional to how cpu interactive they are. Prevents interactive tasks from
starving other interactive tasks during periods of cpu activity. This may have
been causing slowdowns in unlucky circumstances in O6
Con
patch-O7int-0307190129 is available here:
http://kernel.kolivas.org/2.5
and here:
--- linux-2.6.0-test1-mm1/kernel/sched.c 2003-07-17 19:59:16.000000000 +1000
+++ linux-2.6.0-testck1/kernel/sched.c 2003-07-19 01:56:41.000000000 +1000
@@ -76,7 +76,6 @@
#define MIN_SLEEP_AVG (HZ)
#define MAX_SLEEP_AVG (10*HZ)
#define STARVATION_LIMIT (10*HZ)
-#define SLEEP_BUFFER (HZ/100)
#define NODE_THRESHOLD 125
#define MAX_BONUS (MAX_USER_PRIO * PRIO_BONUS_RATIO / 100)
@@ -391,11 +390,11 @@ static inline void activate_task(task_t
if (sleep_time > 0) {
/*
- * Tasks that sleep a long time are categorised as idle and
+ * User tasks that sleep a long time are categorised as idle and
* will get just under interactive status with a small runtime
* to allow them to become interactive or non-interactive rapidly
*/
- if (sleep_time > MIN_SLEEP_AVG){
+ if (sleep_time > MIN_SLEEP_AVG && p->mm){
p->avg_start = jiffies - MIN_SLEEP_AVG;
p->sleep_avg = MIN_SLEEP_AVG * (MAX_BONUS - INTERACTIVE_DELTA - 2) /
MAX_BONUS;
@@ -421,13 +420,8 @@ static inline void activate_task(task_t
*/
p->sleep_avg = (p->sleep_avg * MAX_BONUS / runtime + 1) * runtime / MAX_BONUS;
- /*
- * Keep a small buffer of SLEEP_BUFFER sleep_avg to
- * prevent fully interactive tasks from becoming
- * lower priority with small bursts of cpu usage.
- */
- if (p->sleep_avg > (MAX_SLEEP_AVG + SLEEP_BUFFER))
- p->sleep_avg = MAX_SLEEP_AVG + SLEEP_BUFFER;
+ if (p->sleep_avg > MAX_SLEEP_AVG)
+ p->sleep_avg = MAX_SLEEP_AVG;
}
if (unlikely(p->avg_start > jiffies)){
@@ -1310,10 +1304,12 @@ void scheduler_tick(int user_ticks, int
enqueue_task(p, rq->expired);
} else
enqueue_task(p, rq->active);
- } else if (p->prio < effective_prio(p)){
+ } else if (p->mm && !((task_timeslice(p) - p->time_slice) %
+ (MIN_TIMESLICE * (MAX_BONUS + 1 - p->sleep_avg * MAX_BONUS / MAX_SLEEP_AVG)))){
/*
- * Tasks that have lowered their priority are put to the end
- * of the active array with their remaining timeslice
+ * Running user tasks get requeued with their remaining timeslice
+ * after a period proportional to how cpu intensive they are to
+ * minimise the duration one interactive task can starve another
*/
dequeue_task(p, rq->active);
set_tsk_need_resched(p);
next reply other threads:[~2003-07-18 15:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-18 16:10 Con Kolivas [this message]
2003-07-18 22:53 ` [PATCH] O7int for interactivity Felipe Alfaro Solana
2003-07-19 3:39 ` Eugene Teo
2003-07-18 23:07 ` Mike Fedyk
2003-07-18 23:30 ` Con Kolivas
2003-07-18 23:41 ` Mike Fedyk
2003-07-21 17:23 ` Mike Fedyk
2003-07-19 3:40 ` Eugene Teo
2003-07-19 16:23 ` Mike Fedyk
2003-07-19 1:08 ` William Lee Irwin III
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=200307190210.49687.kernel@kolivas.org \
--to=kernel@kolivas.org \
--cc=akpm@osdl.org \
--cc=davidel@xmailserver.org \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
/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.