All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]O19int
@ 2003-08-29  5:50 Con Kolivas
  2003-08-29  7:39 ` [PATCH]O19int Voluspa
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Con Kolivas @ 2003-08-29  5:50 UTC (permalink / raw)
  To: linux kernel mailing list; +Cc: Andrew Morton, Felipe Alfaro Solana, Voluspa

[-- Attachment #1: clearsigned data --]
[-- Type: Text/Plain, Size: 476 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Small error in the just interactive logic has been corrected.

Idle tasks get one higher priority than just interactive so they don't get 
swamped under heavy load.

Cosmetic cleanup.

Patch against 2.6.0-test4-mm2

Con
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/TumgZUg7+tp6mRURAtkkAJwJKjY1DmvuNR+eyphU07svVP7uWQCeMHgv
pcYhT1dX+iaFq6F1Son8pGc=
=rxj9
-----END PGP SIGNATURE-----

[-- Attachment #2: patch-O18.1-O19int --]
[-- Type: text/x-diff, Size: 2674 bytes --]

--- linux-2.6.0-test4-mm2/kernel/sched.c	2003-08-28 22:57:49.000000000 +1000
+++ linux-2.6.0-test4-mm2-O19/kernel/sched.c	2003-08-29 15:37:06.000000000 +1000
@@ -64,8 +64,8 @@
 /*
  * Some helpers for converting nanosecond timing to jiffy resolution
  */
-#define NS_TO_JIFFIES(TIME)	(TIME / (1000000000 / HZ))
-#define JIFFIES_TO_NS(TIME)	(TIME * (1000000000 / HZ))
+#define NS_TO_JIFFIES(TIME)	((TIME) / (1000000000 / HZ))
+#define JIFFIES_TO_NS(TIME)	((TIME) * (1000000000 / HZ))
 
 /*
  * These are the 'tuning knobs' of the scheduler:
@@ -132,7 +132,8 @@
 	((p)->prio <= (p)->static_prio - DELTA(p))
 
 #define JUST_INTERACTIVE_SLEEP(p) \
-	(MAX_SLEEP_AVG - (DELTA(p) * AVG_TIMESLICE))
+	(JIFFIES_TO_NS(MAX_SLEEP_AVG * \
+		(MAX_BONUS / 2 + DELTA((p)) + 1) / MAX_BONUS - 1))
 
 #define HIGH_CREDIT(p) \
 	((p)->interactive_credit > MAX_SLEEP_AVG)
@@ -382,10 +383,8 @@ static void recalc_task_prio(task_t *p, 
 		 * prevent them suddenly becoming cpu hogs and starving
 		 * other processes.
 		 */
-		if (p->mm && sleep_time >
-			JIFFIES_TO_NS(JUST_INTERACTIVE_SLEEP(p)))
-				p->sleep_avg =
-					JIFFIES_TO_NS(JUST_INTERACTIVE_SLEEP(p));
+		if (p->mm && sleep_time >JUST_INTERACTIVE_SLEEP(p))
+			p->sleep_avg = JUST_INTERACTIVE_SLEEP(p) + 1;
 		else {
 			/*
 			 * The lower the sleep avg a task has the more
@@ -405,16 +404,15 @@ static void recalc_task_prio(task_t *p, 
 			/*
 			 * Non high_credit tasks waking from uninterruptible
 			 * sleep are limited in their sleep_avg rise as they
-			 * are likely to be waiting on I/O
+			 * are likely to be cpu hogs waiting on I/O
 			 */
 			if (p->activated == -1 && !HIGH_CREDIT(p) && p->mm){
-				if (p->sleep_avg >=
-					JIFFIES_TO_NS(JUST_INTERACTIVE_SLEEP(p)))
-						sleep_time = 0;
+				if (p->sleep_avg >= JUST_INTERACTIVE_SLEEP(p))
+					sleep_time = 0;
 				else if (p->sleep_avg + sleep_time >=
-					JIFFIES_TO_NS(JUST_INTERACTIVE_SLEEP(p))){
+					JUST_INTERACTIVE_SLEEP(p)){
 						p->sleep_avg =
-							JIFFIES_TO_NS(JUST_INTERACTIVE_SLEEP(p));
+							JUST_INTERACTIVE_SLEEP(p);
 						sleep_time = 0;
 					}
 			}
@@ -431,7 +429,8 @@ static void recalc_task_prio(task_t *p, 
 
 			if (p->sleep_avg > NS_MAX_SLEEP_AVG){
 				p->sleep_avg = NS_MAX_SLEEP_AVG;
-				p->interactive_credit += !(HIGH_CREDIT(p));
+				if (!HIGH_CREDIT(p))
+					p->interactive_credit++;
 			}
 		}
 	}
@@ -1547,8 +1546,8 @@ switch_tasks:
 	prev->sleep_avg -= run_time;
 	if ((long)prev->sleep_avg <= 0){
 		prev->sleep_avg = 0;
-		prev->interactive_credit -=
-			!(HIGH_CREDIT(prev) || LOW_CREDIT(prev));
+		if (!(HIGH_CREDIT(prev) || LOW_CREDIT(prev)))
+			prev->interactive_credit--;
 	}
 	prev->timestamp = now;
 

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

end of thread, other threads:[~2003-08-30 15:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-29  5:50 [PATCH]O19int Con Kolivas
2003-08-29  7:39 ` [PATCH]O19int Voluspa
2003-08-29 12:01 ` [PATCH]O19int Felipe Alfaro Solana
2003-08-29 15:31 ` [PATCH]O19int Apurva Mehta
2003-08-29 16:29   ` [PATCH]O19int Rahul Karnik
2003-08-29 16:41     ` [PATCH]O19int Apurva Mehta
2003-08-29 17:42       ` [PATCH]O19int Rahul Karnik
2003-08-30 12:42         ` [PATCH]O19int Con Kolivas
2003-08-30 15:45         ` [PATCH]O19int Apurva Mehta
2003-08-29 17:39 ` [PATCH]O19int Maciej Soltysiak

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.