Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jul 2000 06:18:34 -0400 (EDT)
From:      Brian Fundakowski Feldman <green@FreeBSD.org>
To:        Luigi Rizzo <luigi@info.iet.unipi.it>
Cc:        "Jacob A. Hart" <c9710216@studentmail.newcastle.edu.au>, Doug Barton <DougB@gorean.org>, Sheldon Hearn <sheldonh@uunet.co.za>, FreeBSD-CURRENT <freebsd-current@FreeBSD.ORG>
Subject:   Re: Scheduler changes?
Message-ID:  <Pine.BSF.4.21.0007090613210.33233-200000@green.dyndns.org>
In-Reply-To: <200006111520.RAA11260@info.iet.unipi.it>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Sun, 11 Jun 2000, Luigi Rizzo wrote:

> Hi,
> i understand that this means maybe a somwthat
> large change in the system, but what do you think
> if we have a lok at implementing the CPU scheduler using
> weights instead of strict priorities ?
> Do we have parts of the kernel which rely on priority
> to implement locking etc ?
> 
> This would not be too different from what the EclipseBSD people
> did, and the code i recently committed to dummynet can be easily
> reused to this purpose, and it is efficient.
> 
> With a little bit of guidance (I am not too familiar with that area
> of the code) i think we can do something good with little
> effort.

I've been thinking about this a lot.  As for the current scheduler, a
NICE_WEIGHT of 1.8 seems to work nicely; see the attached patch.  I
have been looking more into making things more like Eclipse.  I have to
say I'm very impressed with their work in implementing QoS, and we
would do well to update some of our ancient designs to a model that
resembles theirs.  I'm looking at their process and disk scheduler now,
after reading their network scheduling paper from the Usenix proceedings.
I'm very interested in finding a better algorithm than the current one,
yes :)

> 	cheers
> 	luigi

--
 Brian Fundakowski Feldman           \  FreeBSD: The Power to Serve!  /
 green@FreeBSD.org                    `------------------------------'

[-- Attachment #2 --]
Index: sys/kern/kern_synch.c
===================================================================
RCS file: /usr2/ncvs/src/sys/kern/kern_synch.c,v
retrieving revision 1.95
diff -u -r1.95 kern_synch.c
--- sys/kern/kern_synch.c	2000/07/04 11:25:23	1.95
+++ sys/kern/kern_synch.c	2000/07/08 00:20:23
@@ -916,7 +916,7 @@
 
 	if (p->p_rtprio.type == RTP_PRIO_NORMAL) {
 		newpriority = PUSER + p->p_estcpu / INVERSE_ESTCPU_WEIGHT +
-		    NICE_WEIGHT * (p->p_nice - PRIO_MIN);
+		    (p->p_nice - PRIO_MIN) * NICE_WEIGHT;
 		newpriority = min(newpriority, MAXPRI);
 		p->p_usrpri = newpriority;
 	}
Index: sys/sys/proc.h
===================================================================
RCS file: /usr2/ncvs/src/sys/sys/proc.h,v
retrieving revision 1.106
diff -u -r1.106 proc.h
--- sys/sys/proc.h	2000/06/22 22:27:16	1.106
+++ sys/sys/proc.h	2000/07/08 00:21:14
@@ -405,10 +405,10 @@
  * the range 100-256 Hz (approximately).
  */
 #define	INVERSE_ESTCPU_WEIGHT	8	/* 1 / (priorities per estcpu level) */
-#define	NICE_WEIGHT	1		/* priorities per nice level */
+#define	NICE_WEIGHT	9 / 5		/* priorities per nice level */
 #define	PPQ		(128 / NQS)	/* priorities per queue */
 #define	ESTCPULIM(e) \
-    min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * PRIO_TOTAL - PPQ) + \
+    min((e), INVERSE_ESTCPU_WEIGHT * (PRIO_TOTAL * NICE_WEIGHT - PPQ) + \
 	INVERSE_ESTCPU_WEIGHT - 1)
 
 extern	u_long ps_arg_cache_limit;
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0007090613210.33233-200000>