Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 08 Aug 1997 14:35:41 -0700
From:      Julian Elischer <julian@whistle.com>
To:        current@freebsd.org
Cc:        dyson@freebsd.org
Subject:   tunable quantum patch for review
Message-ID:  <33EB912D.13728473@whistle.com>

next in thread | raw e-mail | index | archive | help
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 <sys/resourcevar.h>
  #include <sys/signalvar.h>
  #include <sys/vmmeter.h>
+ #include <sys/sysctl.h>
  #include <vm/vm.h>
  #include <vm/vm_param.h>
  #include <vm/vm_extern.h>
***************
*** 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--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?33EB912D.13728473>