linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] O6int for interactivity
@ 2003-07-16 14:30 Con Kolivas
  2003-07-16 15:22 ` Felipe Alfaro Solana
                   ` (8 more replies)
  0 siblings, 9 replies; 44+ messages in thread
From: Con Kolivas @ 2003-07-16 14:30 UTC (permalink / raw)
  To: linux kernel mailing list
  Cc: Andrew Morton, Felipe Alfaro Solana, Zwane Mwaikambo

O*int patches trying to improve the interactivity of the 2.5/6 scheduler for 
desktops. It appears possible to do this without moving to nanosecond 
resolution.

This one makes a massive difference... Please test this to death.

Changes:
The big change is in the way sleep_avg is incremented. Any amount of sleep 
will now raise you by at least one priority with each wakeup. This causes 
massive differences to startup time, extremely rapid conversion to interactive 
state, and recovery from non-interactive state rapidly as well (prevents X 
stalling after thrashing around under high loads for many seconds).

The sleep buffer was dropped to just 10ms. This has the effect of causing mild 
round robinning of very interactive tasks if they run for more than 10ms. The 
requeuing was changed from (unlikely()) to an ordinary if.. branch as this 
will be hit much more now.

MAX_BONUS as a #define was made easier to understand

Idle tasks were made slightly less interactive to prevent cpu hogs from 
becoming interactive on their very first wakeup.

Con

This patch-O6int-0307170012 applies on top of 2.6.0-test1-mm1 and can be found 
here:
http://kernel.kolivas.org/2.5

and here:

--- linux-2.6.0-test1-mm1/kernel/sched.c	2003-07-16 20:27:32.000000000 +1000
+++ linux-2.6.0-testck1/kernel/sched.c	2003-07-17 00:13:24.000000000 +1000
@@ -76,9 +76,9 @@
 #define MIN_SLEEP_AVG		(HZ)
 #define MAX_SLEEP_AVG		(10*HZ)
 #define STARVATION_LIMIT	(10*HZ)
-#define SLEEP_BUFFER		(HZ/20)
+#define SLEEP_BUFFER		(HZ/100)
 #define NODE_THRESHOLD		125
-#define MAX_BONUS		((MAX_USER_PRIO - MAX_RT_PRIO) * PRIO_BONUS_RATIO / 100)
+#define MAX_BONUS		(40 * PRIO_BONUS_RATIO / 100)
 
 /*
  * If a task is 'interactive' then we reinsert it in the active
@@ -399,7 +399,7 @@ static inline void activate_task(task_t 
 		 */
 		if (sleep_time > MIN_SLEEP_AVG){
 			p->avg_start = jiffies - MIN_SLEEP_AVG;
-			p->sleep_avg = MIN_SLEEP_AVG * (MAX_BONUS - INTERACTIVE_DELTA - 1) /
+			p->sleep_avg = MIN_SLEEP_AVG * (MAX_BONUS - INTERACTIVE_DELTA - 2) /
 				MAX_BONUS;
 		} else {
 			/*
@@ -413,14 +413,10 @@ static inline void activate_task(task_t 
 			p->sleep_avg += sleep_time;
 
 			/*
-			 * Give a bonus to tasks that wake early on to prevent
-			 * the problem of the denominator in the bonus equation
-			 * from continually getting larger.
+			 * Processes that sleep get pushed to a higher priority
+			 * each time they sleep
 			 */
-			if ((runtime - MIN_SLEEP_AVG) < MAX_SLEEP_AVG)
-				p->sleep_avg += (runtime - p->sleep_avg) *
-					(MAX_SLEEP_AVG + MIN_SLEEP_AVG - runtime) *
-					(MAX_BONUS - INTERACTIVE_DELTA) / MAX_BONUS / MAX_SLEEP_AVG;
+			p->sleep_avg = (p->sleep_avg * MAX_BONUS / runtime + 1) * runtime / MAX_BONUS;
 
 			/*
 			 * Keep a small buffer of SLEEP_BUFFER sleep_avg to
@@ -1311,7 +1307,7 @@ void scheduler_tick(int user_ticks, int 
 			enqueue_task(p, rq->expired);
 		} else
 			enqueue_task(p, rq->active);
-	} else if (unlikely(p->prio < effective_prio(p))){
+	} else if (p->prio < effective_prio(p)){
 		/*
 		 * Tasks that have lowered their priority are put to the end
 		 * of the active array with their remaining timeslice


^ permalink raw reply	[flat|nested] 44+ messages in thread
* Re: [PATCH] O6int for interactivity
@ 2003-07-16 20:20 Shane Shrybman
  0 siblings, 0 replies; 44+ messages in thread
From: Shane Shrybman @ 2003-07-16 20:20 UTC (permalink / raw)
  To: linux-kernel

Hi Con,

I use the infinitely superior (to XMMS), interactive testing tool
mplayer! :-)

My test consists of playing a video in mplayer with software scaling,
(ie. no xv) and refreshing various fat web pages. This as you are fully
aware would cause mozilla to gobble up CPU in short bursts of
approximately .5 - 3 seconds during which time the video would be very
choppy.

06int is much improved in this scenario, the pauses during refreshing
web pages have almost disappeared. There are still very small hiccups in
the video playback during the refreshes.

Also, I use a local web page that queries a local mysql db to display a
large table in mozilla. So, mozilla, apache and mysql are all local.
06int is a huge improvement in this area as well. It is decreases the
choppiness of the video greatly. Previously this would cause almost a
complete halt of the video for several seconds and now I would say there
is only a small amount choppiness. It is still pretty choppy on the
initial load of that page after a reboot, maybe nothing is cached yet?

Thanks for your hard work!

Regards,

Shane





^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2003-07-25 19:25 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-16 14:30 [PATCH] O6int for interactivity Con Kolivas
2003-07-16 15:22 ` Felipe Alfaro Solana
2003-07-16 19:55   ` Marc-Christian Petersen
2003-07-16 17:08 ` Valdis.Kletnieks
2003-07-16 21:59 ` Wiktor Wodecki
2003-07-16 22:30   ` Con Kolivas
2003-07-16 22:12 ` Davide Libenzi
2003-07-17  0:33   ` Con Kolivas
2003-07-17  0:35     ` Davide Libenzi
2003-07-17  1:12       ` Con Kolivas
2003-07-17  0:48     ` Wade
2003-07-17  1:15       ` Con Kolivas
2003-07-17  1:27         ` Eugene Teo
2003-07-17  3:05 ` Wes Janzen
2003-07-17  9:05 ` Alex Riesen
2003-07-17  9:14   ` Con Kolivas
2003-07-18  7:38     ` Alex Riesen
     [not found]       ` <Pine.LNX.4.44.0307251628500.26172-300000@localhost.localdomain>
2003-07-25 19:40         ` Alex Riesen
     [not found] ` <Pine.LNX.4.55.0307161241280.4787@bigblue.dev.mcafeelabs.co m>
2003-07-18  5:38   ` Mike Galbraith
2003-07-18  6:34     ` Nick Piggin
2003-07-18 10:18       ` Mike Galbraith
2003-07-18 10:31         ` Wiktor Wodecki
2003-07-18 10:43           ` Con Kolivas
2003-07-18 11:34             ` Wiktor Wodecki
2003-07-18 11:38               ` Nick Piggin
2003-07-19 10:59                 ` Wiktor Wodecki
2003-07-18 15:46           ` Mike Galbraith
2003-07-18 16:52             ` Davide Libenzi
2003-07-18 17:05               ` Davide Libenzi
2003-07-18 17:39                 ` Valdis.Kletnieks
2003-07-18 19:31                   ` Davide Libenzi
     [not found]                 ` <Pine.LNX.4.55.0307181038450.5608@bigblue.dev.mcafeelabs.co m>
2003-07-18 20:31                   ` Mike Galbraith
2003-07-18 20:38                     ` Davide Libenzi
     [not found]                 ` <Pine.LNX.4.55.0307181333520.5608@bigblue.dev.mcafeelabs.co m>
2003-07-19 17:04                   ` Mike Galbraith
2003-07-21  0:21                     ` Davide Libenzi
     [not found]                 ` <Pine.LNX.4.55.0307201715130.3548@bigblue.dev.mcafeelabs.co m>
2003-07-21  5:36                   ` Mike Galbraith
2003-07-21 12:39                   ` [NOTAPATCH] " Mike Galbraith
2003-07-21 17:13                     ` Mike Galbraith
2003-07-18 14:24         ` Con Kolivas
2003-07-18 15:50           ` Mike Galbraith
2003-07-18 13:46     ` Davide Libenzi
     [not found] ` <Pine.LNX.4.55.0307180630450.5077@bigblue.dev.mcafeelabs.co m>
2003-07-18 15:41   ` Mike Galbraith
     [not found] ` <Pine.LNX.4.55.0307180951050.5608@bigblue.dev.mcafeelabs.co m>
2003-07-18 18:49   ` Mike Galbraith
2003-07-16 20:20 Shane Shrybman

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