9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] scheduler
@ 2014-05-30 16:35 erik quanstrom
  0 siblings, 0 replies; only message in thread
From: erik quanstrom @ 2014-05-30 16:35 UTC (permalink / raw)
  To: 9fans

the 9 schedulers guts break down to the following loop.  this
is the improved version, abstracted a bit (by hand)

	spllo();
	for(;;){
		for(i = Npri-1; i >= 0; i--)
->a			for(p = runqueue[i]; p != nil; p = p->rproc)
				if(softaffinity(p, m) ||
				hardaffinity(p, m) && scheddelay(p) >= Delay)
->b					goto found;
			}
->b		while(monmwait(&runvec, 0) == 0)
				;
		}
	}

it occured to me that having multiple maches fighting over the
runqueue contains contention on number of cache lines.
what we'd like is for the maches to queue up, and try one-at-a-time.
but this is exactly what mcs locks do!  so adding a private lock at
(a) and a private iunlock at (b) is all that is required.

this nearly eliminates the scheduling penalty one saw with the
original version of the revised scheduler, an increases performance
marginally.  maybe 5%.

again, the cavet here is that i haven't tested with a very large multiprocessor.

- erik



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-05-30 16:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-30 16:35 [9fans] scheduler erik quanstrom

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).