Subject: Re: Moving scheduler semantics from cpu_switch() to kern_synch.c
To: None <>
From: Andrew Doran <>
List: tech-kern
Date: 09/20/2006 20:26:00

It's not completely relevant but seems worth mentioning. I have a lot of
changes to scheduler locking and some minor optimisations for the newlock2
branch. I've gotten bogged down working on signalling but hope to get that
stable soon and put the lot on the branch.

The scheme breaks up sched_lock into smaller mutexes and currently looks
like this:

ci->ci_lwp_mutex - running LWPs
sched_mutex - LWPs on run queues, the run queues, other minor items
lwp_mutex - idle LWPs
sq->sq_mutex - sleep/turnstile queues and sleeping LWPs
p->p_smutex - per process sched state

LWPs change mutex in step with their state. It breaks down if we need to
lock more than one LWP at once, but I think that can be avoided. The impact
on UP and older systems can be minimized to some degree but I haven't have a
chance to look at that yet let alone SA.