SMP Scheduling. Followup

Peter Waltenberg (peterw@dascom.com)
Mon, 16 Aug 1999 14:30:51 +1000 (EST)


O.K. since I noted that there might be problems with SMP scheduling
I've collected quite a collection of replies.
Some fall into the "plausible but not necessarilly correct" category

xosview is causing the problem.
A red herring. Yes running it can disturb the scheduler, is that the
cause of the problem ?, probably not. (See below).

Interrupts.
Yes, they get serviced on both CPU's, however interrupts don't get
scheduled, they just eat a (hopefully small) hole in cache and CPU time
then go away again.

And in the best traditions of Linux... here's the code.

Thanks to Andrea Arcangeli for the alternate scheduling policy.
============================ CUT ================================
/*
Program to check for scheduling problems on SMP systems.
*/

#include <stdlib.h>
#include <time.h>
#define NITER 100000
/* change this to match your cache size */
#define BUFLEN (128*1024) /* 128k (size of Celeron Cache) */
int p[BUFLEN/sizeof(int)]; /*Hopefully gcc aligns this for us */
void main()
{
time_t t,t1;
int i;
while(1) {
time(&t);
for(i = 0; i < NITER; i++)
memset(p,i++,BUFLEN);
time(&t1);
t1 -= t;
printf("%d seconds for %d iterations\n",t1,NITER);
}
}
============================ CUT ===================================

Standard Scheduler Andrea SMP-C
Console 17-18 seconds 9-10 seconds

Console + 24-26 seconds 9-10 seconds
X (xdm login)

I'll agree it's fairly pathogical, but it's also the limiting case of a
well written x86 program. It does most of it's work in cache.
Programs that are written with performance in mind will tend to approach this.

Note: This is the hit a single cache heavy process takes with the current
scheduler, it's possibly representative of games and some simulation work,
how well that relates to "real life" is another matter.

Results with multiple "hog" processes running also show Andrea's scheduler
performing better than the standard one.

If anyone has doubts, there's the code. Adjust the buffer size to match the
cache size in your machine and run it yourself.

Andrea's patches are available on:
ftp://ftp.suse.com/pub/people/andrea/kernel-patches/

I'm not saying we should re-write the scheduler on the basis of one
pathological test case, BUT there is now hard evidence to show that
there are cases where the current scheduler is far from optimal, and
that it can be altered to obtain substantial improvements.

Peter

----------------------------------
E-Mail: Peter Waltenberg <peterw@surf.dascom.com>
Date: 16-Aug-99
Time: 14:19:01

This message was sent by XFMail
----------------------------------

-
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/