Re: Scheduler latency

Linus Torvalds (torvalds@transmeta.com)
Wed, 21 Jan 1998 09:58:07 -0800 (PST)


On Wed, 21 Jan 1998, Jauder Ho wrote:
>
> benchsrv%jauderho% uname -a ; ./a.out
> Linux benchsrv.transmeta.com 2.1.62 #5 Mon Nov 3 15:36:46 PST 1997 i686
> Timing 1000 iterations of sched_yield(2) in class SCHED_OTHER
> Total time: 42874 us iteration time: 42 us

The above is a dual SMP..

> sw130%jauderho% uname -a ; ./a.out
> Linux sw130.transmeta.com 2.1.80 #1 Sun Jan 18 21:36:55 PST 1998 i686
> Timing 1000 iterations of sched_yield(2) in class SCHED_OTHER
> Total time: 18989 us iteration time: 18 us

As is sw130..

> marvin%jauderho% uname -a ; ./a.out
> Linux marvin.transmeta.com 2.1.80 #4 Tue Jan 20 19:34:24 PST 1998 i686 unknown
> Timing 1000 iterations of sched_yield(2) in class SCHED_OTHER
> Total time: 192339 us iteration time: 192 us

But "marvin" is a single, right?

> Linus, were there scheduler changes merged into the final 80 patch coz sw130 is
> running the pre-80 patch.

No, there should be almost no difference between what you run on marvin
and what runs on sw130 (apart from the SMP irq stuff, but the fact that
you can run at all on marvin means that you compiled marvin as UP,
right?). BUT sw130 is a dual, which allows us to schedule one process on
one CPU and run another on the other - they can actually partly overlap.
That would certainly explain the difference in times..

> On Wed, 21 Jan 1998, Richard Gooch wrote:
>
> > Hi, all. I've noticed that the scheduler in linux 2.1.79 seems a lot
> > slower than the one in 2.0.25. Results of timing sched_yield(2):
> >
> > PPro/180 running 2.1.79:
> > SCHED_OTHER class: 56 microseconds
> > SCHED_FIFO class: 3 microseconds
> >
> > P133 running 2.0.25:
> > SCHED_OTHER class: 4 microseconds
> > SCHED_FIFO class: 4 microseconds

2.0.25 doesn't actually do anything that all when you run "sched_yield()".
There was a missing "need_resched = 1" in the 2.0.x series, so
sched_yield() actually didn't do anything at all. Which is what you want
if you want to benchmark how fast sched_yield() is, but it is NOT what you
want if you actually want to _do_ sched_yield()..

Linus