This message generated a parse failure. Raw output follows here. Please use 'back' to navigate. From devnull@lkml.org Sat Apr 20 06:11:35 2024 Received: from listserv.funet.fi (listserv.funet.fi [128.214.248.27]) by herbie.ucs.indiana.edu (8.9.3/8.9.3) with ESMTP id QAA01271 for ; Fri, 28 May 1999 16:04:26 -0500 (EST) Received: by listserv.funet.fi via listexpand id <20387-32528>; Thu, 27 May 1999 23:53:44 +0300 Received: by vger.rutgers.edu id ; Thu, 27 May 1999 12:47:24 -0400 Received: from gateway.ukaea.org.uk ([194.128.63.74]:2386 "EHLO ukaea.org.uk") by vger.rutgers.edu with ESMTP id ; Wed, 26 May 1999 16:56:03 -0400 Received: by gateway.ukaea.org.uk id <66306>; Wed, 26 May 1999 21:47:24 +0100 Message-Id: <99May26.214724gmt+0100.66306@gateway.ukaea.org.uk> Date: Wed, 26 May 1999 21:50:03 +0100 From: Neil Conway Organization: Fusion X-Mailer: Mozilla 4.06 [en] (X11; I; Linux 2.0.35 i686) Mime-Version: 1.0 To: "linux-kernel@vger.rutgers.edu" , Linus Torvalds Subject: [PATCH] Assorted counter/sched stuff (resend^2) Content-Type: multipart/mixed; boundary="------------E7E0228CC5B597DB152B972E" Sender: owner-linux-kernel@vger.rutgers.edu Precedence: bulk X-Loop: majordomo@vger.rutgers.edu X-Orcpt: rfc822;linux-kernel-outgoing-dig This is a multi-part message in MIME format. --------------E7E0228CC5B597DB152B972E Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit OK - another go. Perhaps everyone slept through this the last time, cos I can't see it being very contentious... Anyway - if it sucks, please tell me... Neil ps: this needs to go into 2.2 and 2.3 I guess. --------------E7E0228CC5B597DB152B972E Content-Type: message/rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <373AB53E.C662FFD7@ukaea.org.uk> Date: Thu, 13 May 1999 12:19:26 +0100 From: Neil Conway Organization: Fusion X-Mailer: Mozilla 4.06 [en] (X11; I; Linux 2.0.35 i686) MIME-Version: 1.0 To: "linux-kernel@vger.rutgers.edu" , Linus Torvalds Subject: [PATCH] Assorted counter/sched stuff] (resend) Content-Type: multipart/mixed; boundary="------------B308A2BA919884E255927F5D" This is a multi-part message in MIME format. --------------B308A2BA919884E255927F5D Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit This is a resend of a patch I made back in January. It was a bit premature then but since 2.3 has just forked I guess the world should be ready for it now ;-)) *** NB: I'm off-list right now, so please CC me if you want me to notice a reply. *** I just checked it, and it applies cleanly to 2.2.8, even though it's a little grey and dusty by now... cheers Neil PS: As I see it, this will mean that nice +20 will actually cut things to 5% of CPU instead of 10%ish. I forgot to mention that first time around. If I'm being brain-dead please feel free to tell me though. --------------B308A2BA919884E255927F5D Content-Type: message/rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <36AE4B22.486D842B@ukaea.org.uk> Date: Tue, 26 Jan 1999 23:09:22 +0000 From: Neil Conway Organization: Fusion X-Mailer: Mozilla 4.06 [en] (X11; I; Linux 2.0.35 i686) MIME-Version: 1.0 To: Linus Torvalds , "linux-kernel@vger.rutgers.edu" Subject: [PATCH] Assorted counter/sched stuff Content-Type: multipart/mixed; boundary="------------06F43BBD6BF0811BBB6B78A0" This is a multi-part message in MIME format. --------------06F43BBD6BF0811BBB6B78A0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit (I didn't get this done before pre9 so I waited till now!) This is a collection of two types of fix: (a) drivers doing "current->counter =0;schedule()" with TASK_INTERRUPTIBLE set; (b) lots of architectures doing "if (current->counter <0)" when they should really have tested for "<= 0". (I don't know if it's safe to test "== 0" since I'm not certain that setting need_resched will ALWAYS prevent another timer-tick happening in the same context.) This also reverts the timeslice length comments to "200 ms" (calling it "210 ms" was incorrect on Alphas anyway due to HZ != 100). There are still loads of places (mostly in the fs code) where we do "current->counter =0;schedule()", but I don't know of any better way to do the waits in those cases. Perhaps they are conceptually optimal anyway. Neil --------------06F43BBD6BF0811BBB6B78A0 Content-Type: text/plain; charset=us-ascii; name="njccounterpatch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="njccounterpatch" diff -ur linux-2.2.0/arch/alpha/kernel/smp.c linux-2.2.0.njc/arch/alpha/kernel/smp.c --- linux-2.2.0/arch/alpha/kernel/smp.c Sun Jan 17 01:02:50 1999 +++ linux-2.2.0.njc/arch/alpha/kernel/smp.c Tue Jan 26 22:42:14 1999 @@ -390,7 +390,7 @@ if (current->pid) { update_one_process(current, 1, user, !user, cpu); - if (--current->counter < 0) { + if (--current->counter <= 0) { current->counter = 0; current->need_resched = 1; } diff -ur linux-2.2.0/arch/i386/kernel/smp.c linux-2.2.0.njc/arch/i386/kernel/smp.c --- linux-2.2.0/arch/i386/kernel/smp.c Tue Jan 26 18:09:10 1999 +++ linux-2.2.0.njc/arch/i386/kernel/smp.c Tue Jan 26 22:49:43 1999 @@ -1696,7 +1696,7 @@ update_one_process(p, 1, user, system, cpu); p->counter -= 1; - if (p->counter < 0) { + if (p->counter <= 0) { p->counter = 0; p->need_resched = 1; } diff -ur linux-2.2.0/arch/ppc/kernel/smp.c linux-2.2.0.njc/arch/ppc/kernel/smp.c --- linux-2.2.0/arch/ppc/kernel/smp.c Wed Dec 30 18:55:07 1998 +++ linux-2.2.0.njc/arch/ppc/kernel/smp.c Tue Jan 26 22:43:06 1999 @@ -77,7 +77,7 @@ update_one_process(p, 1, user, system, cpu); p->counter -= 1; - if (p->counter < 0) { + if (p->counter <= 0) { p->counter = 0; current->need_resched = 1; } diff -ur linux-2.2.0/arch/sparc/kernel/sun4d_smp.c linux-2.2.0.njc/arch/sparc/kernel/sun4d_smp.c --- linux-2.2.0/arch/sparc/kernel/sun4d_smp.c Mon Nov 16 18:37:28 1998 +++ linux-2.2.0.njc/arch/sparc/kernel/sun4d_smp.c Tue Jan 26 22:42:37 1999 @@ -471,7 +471,7 @@ if(current->pid) { update_one_process(current, 1, user, !user, cpu); - if(--current->counter < 0) { + if(--current->counter <= 0) { current->counter = 0; current->need_resched = 1; } diff -ur linux-2.2.0/arch/sparc/kernel/sun4m_smp.c linux-2.2.0.njc/arch/sparc/kernel/sun4m_smp.c --- linux-2.2.0/arch/sparc/kernel/sun4m_smp.c Mon Nov 16 18:37:28 1998 +++ linux-2.2.0.njc/arch/sparc/kernel/sun4m_smp.c Tue Jan 26 22:42:54 1999 @@ -451,7 +451,7 @@ if(current->pid) { update_one_process(current, 1, user, !user, cpu); - if(--current->counter < 0) { + if(--current->counter <= 0) { current->counter = 0; current->need_resched = 1; } diff -ur linux-2.2.0/arch/sparc64/kernel/smp.c linux-2.2.0.njc/arch/sparc64/kernel/smp.c --- linux-2.2.0/arch/sparc64/kernel/smp.c Tue Oct 27 17:52:20 1998 +++ linux-2.2.0.njc/arch/sparc64/kernel/smp.c Tue Jan 26 22:43:37 1999 @@ -578,7 +578,7 @@ unsigned int *inc, *inc2; update_one_process(current, 1, user, !user, cpu); - if(--current->counter < 0) { + if(--current->counter <= 0) { current->counter = 0; current->need_resched = 1; } diff -ur linux-2.2.0/drivers/char/cyclades.c linux-2.2.0.njc/drivers/char/cyclades.c --- linux-2.2.0/drivers/char/cyclades.c Wed Jan 20 21:26:20 1999 +++ linux-2.2.0.njc/drivers/char/cyclades.c Tue Jan 26 22:37:33 1999 @@ -2597,7 +2597,6 @@ printk("Not clean (jiff=%lu)...", jiffies); #endif current->state = TASK_INTERRUPTIBLE; - current->counter = 0; /* make us low-priority */ schedule_timeout(char_time); if (signal_pending(current)) break; @@ -2610,7 +2609,6 @@ } /* Run one more char cycle */ current->state = TASK_INTERRUPTIBLE; - current->counter = 0; /* make us low-priority */ schedule_timeout(char_time * 5); current->state = TASK_RUNNING; #ifdef CY_DEBUG_WAIT_UNTIL_SENT diff -ur linux-2.2.0/drivers/char/esp.c linux-2.2.0.njc/drivers/char/esp.c --- linux-2.2.0/drivers/char/esp.c Sat Oct 31 19:06:21 1998 +++ linux-2.2.0.njc/drivers/char/esp.c Tue Jan 26 22:38:03 1999 @@ -2180,7 +2180,6 @@ while ((serial_in(info, UART_ESI_STAT1) != 0x03) || (serial_in(info, UART_ESI_STAT2) != 0xff)) { current->state = TASK_INTERRUPTIBLE; - current->counter = 0; schedule_timeout(char_time); if (signal_pending(current)) diff -ur linux-2.2.0/drivers/char/rocket.c linux-2.2.0.njc/drivers/char/rocket.c --- linux-2.2.0/drivers/char/rocket.c Thu Nov 5 17:58:43 1998 +++ linux-2.2.0.njc/drivers/char/rocket.c Tue Jan 26 22:38:25 1999 @@ -1663,7 +1663,6 @@ jiffies, check_time); #endif current->state = TASK_INTERRUPTIBLE; - current->counter = 0; /* make us low-priority */ schedule_timeout(check_time); if (signal_pending(current)) break; diff -ur linux-2.2.0/drivers/char/serial.c linux-2.2.0.njc/drivers/char/serial.c --- linux-2.2.0/drivers/char/serial.c Thu Jan 14 18:27:53 1999 +++ linux-2.2.0.njc/drivers/char/serial.c Tue Jan 26 22:38:48 1999 @@ -2376,7 +2376,6 @@ printk("lsr = %d (jiff=%lu)...", lsr, jiffies); #endif current->state = TASK_INTERRUPTIBLE; - current->counter = 0; /* make us low-priority */ schedule_timeout(char_time); if (signal_pending(current)) break; diff -ur linux-2.2.0/drivers/macintosh/macserial.c linux-2.2.0.njc/drivers/macintosh/macserial.c --- linux-2.2.0/drivers/macintosh/macserial.c Wed Dec 23 17:44:41 1998 +++ linux-2.2.0.njc/drivers/macintosh/macserial.c Tue Jan 26 22:39:57 1999 @@ -1324,7 +1324,6 @@ char_time = MIN(char_time, timeout); while ((read_zsreg(info->zs_channel, 1) & ALL_SNT) == 0) { current->state = TASK_INTERRUPTIBLE; - current->counter = 0; /* make us low-priority */ schedule_timeout(char_time); if (signal_pending(current)) break; diff -ur linux-2.2.0/drivers/sbus/char/sab82532.c linux-2.2.0.njc/drivers/sbus/char/sab82532.c --- linux-2.2.0/drivers/sbus/char/sab82532.c Wed Dec 23 17:44:41 1998 +++ linux-2.2.0.njc/drivers/sbus/char/sab82532.c Tue Jan 26 22:39:15 1999 @@ -1672,7 +1672,6 @@ #endif while (info->xmit_cnt || !info->all_sent) { current->state = TASK_INTERRUPTIBLE; - current->counter = 0; schedule_timeout(char_time); if (signal_pending(current)) break; diff -ur linux-2.2.0/drivers/sbus/char/su.c linux-2.2.0.njc/drivers/sbus/char/su.c --- linux-2.2.0/drivers/sbus/char/su.c Wed Dec 23 17:44:41 1998 +++ linux-2.2.0.njc/drivers/sbus/char/su.c Tue Jan 26 22:39:35 1999 @@ -1814,7 +1814,6 @@ printk("lsr = %d (jiff=%lu)...", lsr, jiffies); #endif current->state = TASK_INTERRUPTIBLE; - current->counter = 0; /* make us low-priority */ schedule_timeout(char_time); if (signal_pending(current)) break; diff -ur linux-2.2.0/include/linux/sched.h linux-2.2.0.njc/include/linux/sched.h --- linux-2.2.0/include/linux/sched.h Tue Jan 26 00:06:22 1999 +++ linux-2.2.0.njc/include/linux/sched.h Tue Jan 26 22:44:43 1999 @@ -338,7 +338,7 @@ */ #define _STK_LIM (8*1024*1024) -#define DEF_PRIORITY (20*HZ/100) /* 210 ms time slices */ +#define DEF_PRIORITY (20*HZ/100) /* 200 ms time slices */ /* * INIT_TASK is used to set up the first task table, touch at diff -ur linux-2.2.0/kernel/sched.c linux-2.2.0.njc/kernel/sched.c --- linux-2.2.0/kernel/sched.c Tue Jan 19 18:19:58 1999 +++ linux-2.2.0.njc/kernel/sched.c Tue Jan 26 22:52:31 1999 @@ -1350,7 +1350,7 @@ unsigned long user = ticks - system; if (p->pid) { p->counter -= ticks; - if (p->counter < 0) { + if (p->counter <= 0) { p->counter = 0; p->need_resched = 1; } @@ -1553,7 +1553,7 @@ * do a "normalization" of the priority (traditionally * Unix nice values are -20 to 20; Linux doesn't really * use that kind of thing, but uses the length of the - * timeslice instead (default 210 ms). The rounding is + * timeslice instead (default 200 ms). The rounding is * why we want to avoid negative values. */ newprio = (newprio * DEF_PRIORITY + 10) / 20; --------------06F43BBD6BF0811BBB6B78A0-- --------------B308A2BA919884E255927F5D-- --------------E7E0228CC5B597DB152B972E-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/