linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]O20int
@ 2003-09-03 14:53 Con Kolivas
  2003-09-03 19:19 ` [PATCH]O20int Mike Fedyk
  2003-09-07  5:41 ` [PATCH]O20int Matt Heler
  0 siblings, 2 replies; 7+ messages in thread
From: Con Kolivas @ 2003-09-03 14:53 UTC (permalink / raw)
  To: linux kernel mailing list; +Cc: Andrew Morton

[-- Attachment #1: clearsigned data --]
[-- Type: Text/Plain, Size: 886 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fine tuning mainly.

Smaller timeslice granularity for most interactive tasks and larger for less 
interactive. Smaller for each extra cpu.

Smaller bounds on interactive credit.

Idle tasks can gain interactive credits; Idle tasks get more interactivity; 
Uninterruptible sleep wakers are not seen as idle.

Kernel threads participate in timeslice granularity requeuing.

This patch is incremental on top of O19int which is included in 
2.6.0-test4-mm4. It will not apply onto mm5 which has all my stuff backed 
out. This patch and a full patch against 2.6.0-test4 can be found here:

http://kernel.kolivas.org/2.5

Con
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/VgBaZUg7+tp6mRURAtvgAJoClT078T9wLLlEq8+pct3Yigrq3wCgja4P
HjXKw3YJSey4DWpA2I+Tyi4=
=nvCB
-----END PGP SIGNATURE-----

[-- Attachment #2: patch-O19-O20int --]
[-- Type: text/x-diff, Size: 2762 bytes --]

--- linux-2.6.0-test4-mm4-O19/kernel/sched.c	2003-08-31 19:33:09.000000000 +1000
+++ linux-2.6.0-test4-mm4/kernel/sched.c	2003-09-04 00:12:25.000000000 +1000
@@ -76,7 +76,6 @@
  */
 #define MIN_TIMESLICE		( 10 * HZ / 1000)
 #define MAX_TIMESLICE		(200 * HZ / 1000)
-#define TIMESLICE_GRANULARITY	(HZ/40 ?: 1)
 #define ON_RUNQUEUE_WEIGHT	30
 #define CHILD_PENALTY		95
 #define PARENT_PENALTY		100
@@ -88,6 +87,7 @@
 #define STARVATION_LIMIT	(MAX_SLEEP_AVG)
 #define NS_MAX_SLEEP_AVG	(JIFFIES_TO_NS(MAX_SLEEP_AVG))
 #define NODE_THRESHOLD		125
+#define CREDIT_LIMIT		100
 
 /*
  * If a task is 'interactive' then we reinsert it in the active
@@ -121,6 +121,15 @@
 	(NS_TO_JIFFIES((p)->sleep_avg) * MAX_BONUS / \
 		MAX_SLEEP_AVG)
 
+#ifdef CONFIG_SMP
+#define TIMESLICE_GRANULARITY(p) \
+	(MIN_TIMESLICE * (1 << (MAX_BONUS - CURRENT_BONUS(p))) * \
+		num_online_cpus())
+#else
+#define TIMESLICE_GRANULARITY(p) \
+	(MIN_TIMESLICE * (1 << (MAX_BONUS - CURRENT_BONUS(p))))
+#endif
+
 #define SCALE(v1,v1_max,v2_max) \
 	(v1) * (v2_max) / (v1_max)
 
@@ -136,10 +145,10 @@
 		(MAX_BONUS / 2 + DELTA((p)) + 1) / MAX_BONUS - 1))
 
 #define HIGH_CREDIT(p) \
-	((p)->interactive_credit > MAX_SLEEP_AVG)
+	((p)->interactive_credit > CREDIT_LIMIT)
 
 #define LOW_CREDIT(p) \
-	((p)->interactive_credit < -MAX_SLEEP_AVG)
+	((p)->interactive_credit < -CREDIT_LIMIT)
 
 #define TASK_PREEMPTS_CURR(p, rq) \
 	((p)->prio < (rq)->curr->prio)
@@ -383,9 +392,13 @@ static void recalc_task_prio(task_t *p, 
 		 * prevent them suddenly becoming cpu hogs and starving
 		 * other processes.
 		 */
-		if (p->mm && sleep_time >JUST_INTERACTIVE_SLEEP(p))
-			p->sleep_avg = JUST_INTERACTIVE_SLEEP(p) + 1;
-		else {
+		if (p->mm && p->activated != -1 &&
+			sleep_time > JUST_INTERACTIVE_SLEEP(p)){
+				p->sleep_avg = JIFFIES_TO_NS(MAX_SLEEP_AVG -
+						AVG_TIMESLICE);
+				if (!HIGH_CREDIT(p))
+					p->interactive_credit++;
+		} else {
 			/*
 			 * The lower the sleep avg a task has the more
 			 * rapidly it will rise with sleep time.
@@ -1411,12 +1424,12 @@ void scheduler_tick(int user_ticks, int 
 		 * level, which is in essence a round-robin of tasks with
 		 * equal priority.
 		 *
-		 * This only applies to user tasks in the interactive
-		 * delta range with at least MIN_TIMESLICE left.
+		 * This only applies to tasks in the interactive
+		 * delta range with at least MIN_TIMESLICE to requeue.
 		 */
-		if (p->mm && TASK_INTERACTIVE(p) && !((task_timeslice(p) -
-			p->time_slice) % TIMESLICE_GRANULARITY) &&
-			(p->time_slice > MIN_TIMESLICE) &&
+		if (TASK_INTERACTIVE(p) && !((task_timeslice(p) -
+			p->time_slice) % TIMESLICE_GRANULARITY(p)) &&
+			(p->time_slice >= (MIN_TIMESLICE * 2)) &&
 			(p->array == rq->active)) {
 
 			dequeue_task(p, rq->active);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]O20int
  2003-09-03 14:53 [PATCH]O20int Con Kolivas
@ 2003-09-03 19:19 ` Mike Fedyk
  2003-09-03 22:55   ` [PATCH]O20int Con Kolivas
  2003-09-07  5:41 ` [PATCH]O20int Matt Heler
  1 sibling, 1 reply; 7+ messages in thread
From: Mike Fedyk @ 2003-09-03 19:19 UTC (permalink / raw)
  To: Con Kolivas; +Cc: linux kernel mailing list, Andrew Morton

On Thu, Sep 04, 2003 at 12:53:10AM +1000, Con Kolivas wrote:
> Smaller timeslice granularity for most interactive tasks and larger for less 
> interactive. Smaller for each extra cpu.

> +#ifdef CONFIG_SMP
> +#define TIMESLICE_GRANULARITY(p) \
> +	(MIN_TIMESLICE * (1 << (MAX_BONUS - CURRENT_BONUS(p))) * \
> +		num_online_cpus())
> +#else
> +#define TIMESLICE_GRANULARITY(p) \
> +	(MIN_TIMESLICE * (1 << (MAX_BONUS - CURRENT_BONUS(p))))
> +#endif
> +

Don't you want to put a max(10,TIMESLICE_GRANULARITY) in there so that the
time slice won't go below 1ms for large proc servers?  I'm not sure if it
was you, or someone else but they did some testing to see how the
timeslice length affected the cache warmth, and the major improvements
stopped after 7ms, so 10 might be a good default mimimum.

Mike

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]O20int
  2003-09-03 19:19 ` [PATCH]O20int Mike Fedyk
@ 2003-09-03 22:55   ` Con Kolivas
  2003-09-04  0:12     ` [PATCH]O20int Mike Fedyk
  0 siblings, 1 reply; 7+ messages in thread
From: Con Kolivas @ 2003-09-03 22:55 UTC (permalink / raw)
  To: Mike Fedyk; +Cc: linux kernel mailing list, Andrew Morton

On Thu, 4 Sep 2003 05:19, Mike Fedyk wrote:
> On Thu, Sep 04, 2003 at 12:53:10AM +1000, Con Kolivas wrote:
> > Smaller timeslice granularity for most interactive tasks and larger for
> > less interactive. Smaller for each extra cpu.
> >
> > +#ifdef CONFIG_SMP
> > +#define TIMESLICE_GRANULARITY(p) \
> > +	(MIN_TIMESLICE * (1 << (MAX_BONUS - CURRENT_BONUS(p))) * \
> > +		num_online_cpus())
> > +#else
> > +#define TIMESLICE_GRANULARITY(p) \
> > +	(MIN_TIMESLICE * (1 << (MAX_BONUS - CURRENT_BONUS(p))))
> > +#endif
> > +
>
> Don't you want to put a max(10,TIMESLICE_GRANULARITY) in there so that the
> time slice won't go below 1ms for large proc servers?  I'm not sure if it
> was you, or someone else but they did some testing to see how the
> timeslice length affected the cache warmth, and the major improvements
> stopped after 7ms, so 10 might be a good default mimimum.

That works out to 10ms minimum.

Con


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]O20int
  2003-09-03 22:55   ` [PATCH]O20int Con Kolivas
@ 2003-09-04  0:12     ` Mike Fedyk
  2003-09-04  0:27       ` [PATCH]O20int Con Kolivas
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Fedyk @ 2003-09-04  0:12 UTC (permalink / raw)
  To: Con Kolivas; +Cc: linux kernel mailing list, Andrew Morton

On Thu, Sep 04, 2003 at 08:55:45AM +1000, Con Kolivas wrote:
> On Thu, 4 Sep 2003 05:19, Mike Fedyk wrote:
> > On Thu, Sep 04, 2003 at 12:53:10AM +1000, Con Kolivas wrote:
> > > Smaller timeslice granularity for most interactive tasks and larger for
> > > less interactive. Smaller for each extra cpu.
> > >
> > > +#ifdef CONFIG_SMP
> > > +#define TIMESLICE_GRANULARITY(p) \
> > > +	(MIN_TIMESLICE * (1 << (MAX_BONUS - CURRENT_BONUS(p))) * \
> > > +		num_online_cpus())
> > > +#else
> > > +#define TIMESLICE_GRANULARITY(p) \
> > > +	(MIN_TIMESLICE * (1 << (MAX_BONUS - CURRENT_BONUS(p))))
> > > +#endif
> > > +
> >
> > Don't you want to put a max(10,TIMESLICE_GRANULARITY) in there so that the
> > time slice won't go below 1ms for large proc servers?  I'm not sure if it
> > was you, or someone else but they did some testing to see how the
> > timeslice length affected the cache warmth, and the major improvements
> > stopped after 7ms, so 10 might be a good default mimimum.
> 
> That works out to 10ms minimum.

With how many processors? 64? 128?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]O20int
  2003-09-04  0:12     ` [PATCH]O20int Mike Fedyk
@ 2003-09-04  0:27       ` Con Kolivas
  2003-09-04  1:52         ` [PATCH]O20int Mike Fedyk
  0 siblings, 1 reply; 7+ messages in thread
From: Con Kolivas @ 2003-09-04  0:27 UTC (permalink / raw)
  To: Mike Fedyk; +Cc: linux kernel mailing list, Andrew Morton

On Thu, 4 Sep 2003 10:12, Mike Fedyk wrote:
> On Thu, Sep 04, 2003 at 08:55:45AM +1000, Con Kolivas wrote:
> > On Thu, 4 Sep 2003 05:19, Mike Fedyk wrote:
> > > On Thu, Sep 04, 2003 at 12:53:10AM +1000, Con Kolivas wrote:
> > > > Smaller timeslice granularity for most interactive tasks and larger
> > > > for less interactive. Smaller for each extra cpu.
> > > >
> > > > +#ifdef CONFIG_SMP
> > > > +#define TIMESLICE_GRANULARITY(p) \
> > > > +	(MIN_TIMESLICE * (1 << (MAX_BONUS - CURRENT_BONUS(p))) * \
> > > > +		num_online_cpus())
> > > > +#else
> > > > +#define TIMESLICE_GRANULARITY(p) \
> > > > +	(MIN_TIMESLICE * (1 << (MAX_BONUS - CURRENT_BONUS(p))))
> > > > +#endif
> > > > +
> > >
> > > Don't you want to put a max(10,TIMESLICE_GRANULARITY) in there so that
> > > the time slice won't go below 1ms for large proc servers?  I'm not sure
> > > if it was you, or someone else but they did some testing to see how the
> > > timeslice length affected the cache warmth, and the major improvements
> > > stopped after 7ms, so 10 might be a good default mimimum.
> >
> > That works out to 10ms minimum.
>
> With how many processors? 64? 128?

1 cpu = 10ms minimum
2 cpus = 20ms minimum
and so on.

MIN_TIMESLICE * (1 << (MAX_BONUS - CURRENT_BONUS(p))) * num_online_cpus())

works out to:
10 * num_online_cpus()
as the minimum

and 

10 * 1024 * num_online_cpus()

as the maximum

Con


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]O20int
  2003-09-04  0:27       ` [PATCH]O20int Con Kolivas
@ 2003-09-04  1:52         ` Mike Fedyk
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Fedyk @ 2003-09-04  1:52 UTC (permalink / raw)
  To: Con Kolivas; +Cc: linux kernel mailing list, Andrew Morton

On Thu, Sep 04, 2003 at 10:27:29AM +1000, Con Kolivas wrote:
> On Thu, 4 Sep 2003 10:12, Mike Fedyk wrote:
> > With how many processors? 64? 128?
> 
> 1 cpu = 10ms minimum
> 2 cpus = 20ms minimum
> and so on.
> 
> MIN_TIMESLICE * (1 << (MAX_BONUS - CURRENT_BONUS(p))) * num_online_cpus())
> 
> works out to:
> 10 * num_online_cpus()
> as the minimum
> 
> and 
> 
> 10 * 1024 * num_online_cpus()
> 
> as the maximum

Ok brain fart.  I thought you were deviding based on the number of CPUs...
(misread the macro wrap for a "/" devide)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]O20int
  2003-09-03 14:53 [PATCH]O20int Con Kolivas
  2003-09-03 19:19 ` [PATCH]O20int Mike Fedyk
@ 2003-09-07  5:41 ` Matt Heler
  1 sibling, 0 replies; 7+ messages in thread
From: Matt Heler @ 2003-09-07  5:41 UTC (permalink / raw)
  To: Con Kolivas, linux kernel mailing list

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wow.. I tried 2.6.0-test4-mm4 + your 020 init patch on top .. I've noticed 
consiberable improvements. When I last used your scheduler patches WineX used 
to pauses in Warcraft3 , now no such pauses exist.. and everything seems 
smooth and snappy ..  great work

Matt


On Wednesday 03 September 2003 07:53 am, Con Kolivas wrote:
> \x02D----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Fine tuning mainly.
>
> Smaller timeslice granularity for most interactive tasks and larger for
> less interactive. Smaller for each extra cpu.
>
> Smaller bounds on interactive credit.
>
> Idle tasks can gain interactive credits; Idle tasks get more interactivity;
> Uninterruptible sleep wakers are not seen as idle.
>
> Kernel threads participate in timeslice granularity requeuing.
>
> This patch is incremental on top of O19int which is included in
> 2.6.0-test4-mm4. It will not apply onto mm5 which has all my stuff backed
> out. This patch and a full patch against 2.6.0-test4 can be found here:
>
> http://kernel.kolivas.org/2.5
>
> Con
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.2 (GNU/Linux)
>
> iD8DBQE/VgBaZUg7+tp6mRURAtvgAJoClT078T9wLLlEq8+pct3Yigrq3wCgja4P
> HjXKw3YJSey4DWpA2I+Tyi4=
> =nvCB
> -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/WsUUleY/n9G/oZ8RAgXcAJ43BQouqQkq1IVz6ujh1P44xnl/dACfTg4J
6KRKy+GrhNu2FC3rPSruT6M=
=fwqL
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-09-07  5:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-03 14:53 [PATCH]O20int Con Kolivas
2003-09-03 19:19 ` [PATCH]O20int Mike Fedyk
2003-09-03 22:55   ` [PATCH]O20int Con Kolivas
2003-09-04  0:12     ` [PATCH]O20int Mike Fedyk
2003-09-04  0:27       ` [PATCH]O20int Con Kolivas
2003-09-04  1:52         ` [PATCH]O20int Mike Fedyk
2003-09-07  5:41 ` [PATCH]O20int Matt Heler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).