Received: from mnm [127.0.0.1]
	by localhost with POP3 (fetchmail-5.9.0)
	for akpm@localhost (single-drop); Mon, 04 Aug 2003 04:47:54 -0700 (PDT)
Received: from fire-1.osdl.org (air1.pdx.osdl.net [172.20.0.5])
	by mail.osdl.org (8.11.6/8.11.6) with ESMTP id h74BiuI03203
	for <akpm@osdl.org>; Mon, 4 Aug 2003 04:44:56 -0700
Received: from mail.kolivas.org (c210-49-248-224.thoms1.vic.optusnet.com.au [210.49.248.224])
	by fire-1.osdl.org (8.12.8/8.12.8) with ESMTP id h74Bire5029340
	for <akpm@osdl.org>; Mon, 4 Aug 2003 04:44:55 -0700
Received: from pc.kolivas.org (unknown [192.168.1.251])
	by mail.kolivas.org (Postfix) with ESMTP
	id 3C87B31792; Mon,  4 Aug 2003 07:44:51 -0400 (EDT)
From: Con Kolivas <kernel@kolivas.org>
To: linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: [PATCH] O12.3 for interactivity
Date: Mon, 4 Aug 2003 21:50:01 +1000
User-Agent: KMail/1.5.3
Cc: Andrew Morton <akpm@osdl.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200308042150.01715.kernel@kolivas.org>
X-Spam-Status: No, hits=-12.7 required=6.0
	tests=BAYES_00,USER_AGENT_KMAIL
	autolearn=ham version=2.53
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.53 (1.174.2.15-2003-03-30-exp)

Here is a small patch against O12.2. This should not change peformance in any 
way but removes redundant code (which we all love to do). Ingo pointed out
that new forks wont have any sleep time to earn as sleep_avg. It is also
extrememly unlikely that there won't be any sleep time with nanosecond 
timing. Patch applies to 2.6.0-test2-mm4 or test2 patched with O12.2.

Con

diff -Naurp linux-2.6.0-test2-mm4/kernel/sched.c linux-2.6.0-test2-mm4-O12.3/kernel/sched.c
--- linux-2.6.0-test2-mm4/kernel/sched.c	2003-08-04 20:16:02.000000000 +1000
+++ linux-2.6.0-test2-mm4-O12.3/kernel/sched.c	2003-08-04 20:19:10.000000000 +1000
@@ -365,9 +365,6 @@ static void recalc_task_prio(task_t *p, 
 	unsigned long long __sleep_time = now - p->timestamp;
 	unsigned long sleep_time;
 
-	if (unlikely(!p->timestamp))
-		__sleep_time = 0;
-
 	if (__sleep_time > NS_MAX_SLEEP_AVG)
 		sleep_time = NS_MAX_SLEEP_AVG;
 	else
@@ -420,8 +417,7 @@ static void recalc_task_prio(task_t *p, 
 				p->interactive_credit++;
 			}
 		}
-	} else if (!p->sleep_avg)
-		p->interactive_credit--;
+	}
 
 	p->prio = effective_prio(p);
 }
@@ -454,9 +450,6 @@ static inline void activate_task(task_t 
 	 */
 		p->activated = 1;
 
-	if (unlikely(!p->timestamp))
-		p->activated = 0;
-
 	p->timestamp = now;
 
 	__activate_task(p, rq);
@@ -644,7 +637,6 @@ void wake_up_forked_process(task_t * p)
 	p->sleep_avg = JIFFIES_TO_NS(sleep_avg);
 
 	p->interactive_credit = 0;
-	p->timestamp = 0;
 
 	p->prio = effective_prio(p);
 	set_task_cpu(p, smp_processor_id());