From owner-freebsd-current Fri Aug 8 14:41:00 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id OAA16311 for current-outgoing; Fri, 8 Aug 1997 14:41:00 -0700 (PDT) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id OAA16302; Fri, 8 Aug 1997 14:40:47 -0700 (PDT) Received: (from daemon@localhost) by alpo.whistle.com (8.8.5/8.8.5) id OAA06314; Fri, 8 Aug 1997 14:37:59 -0700 (PDT) Received: from current1.whistle.com(207.76.205.22) via SMTP by alpo.whistle.com, id smtpd006311; Fri Aug 8 21:37:55 1997 Message-ID: <33EB912D.13728473@whistle.com> Date: Fri, 08 Aug 1997 14:35:41 -0700 From: Julian Elischer Organization: Whistle Communications X-Mailer: Mozilla 3.0Gold (X11; I; FreeBSD 2.2-CURRENT i386) MIME-Version: 1.0 To: current@freebsd.org CC: dyson@freebsd.org Subject: tunable quantum patch for review Content-Type: multipart/mixed; boundary="------------2C67412E284797A9500F9F30" Sender: owner-freebsd-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk This is a multi-part message in MIME format. --------------2C67412E284797A9500F9F30 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit We use this at whistle. john Dyson said he'd like it included.. So I've cleaned it up a bit (we didn't check against a 0 value) any objections before I add it? julian --------------2C67412E284797A9500F9F30 Content-Type: text/plain; charset=us-ascii; name="xx" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xx" Index: kern_synch.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_synch.c,v retrieving revision 1.31 diff -c -r1.31 kern_synch.c *** kern_synch.c 1997/04/26 11:46:15 1.31 --- kern_synch.c 1997/08/08 21:33:16 *************** *** 51,56 **** --- 51,57 ---- #include #include #include + #include #include #include #include *************** *** 69,74 **** --- 70,98 ---- extern void endtsleep __P((void *)); extern void updatepri __P((struct proc *p)); + #define MAXIMUM_SCHEDULE_QUANTUM (1000000) /* arbitrary limit */ + #ifndef DEFAULT_SCHEDULE_QUANTUM + #define DEFAULT_SCHEDULE_QUANTUM 10 + #endif + static int quantum = DEFAULT_SCHEDULE_QUANTUM; /* default value */ + + static int + sysctl_kern_quantum SYSCTL_HANDLER_ARGS + { + int error; + int new_val = quantum; + + new_val = quantum; + error = sysctl_handle_int(oidp, &new_val, 0, req); + if ((error == 0) && (new_val > 0) && (new_val < MAXIMUM_SCHEDULE_QUANTUM)) { + quantum = new_val; + } + return (error); + } + + SYSCTL_PROC(_kern, OID_AUTO, quantum, CTLTYPE_INT|CTLFLAG_RW, + 0, sizeof quantum, sysctl_kern_quantum, "I", ""); + /* * Force switch among equal priority processes every 100ms. */ *************** *** 79,85 **** { need_resched(); ! timeout(roundrobin, NULL, hz / 10); } /* --- 103,109 ---- { need_resched(); ! timeout(roundrobin, NULL, hz / quantum); } /* --------------2C67412E284797A9500F9F30--