cvs commit: src/sys/i386/i386 pmap.c

Alan Cox alc at cs.rice.edu
Fri Oct 29 21:51:24 PDT 2004


On Fri, Oct 29, 2004 at 05:51:30PM -0500, Mike Silbersack wrote:
> 
[snip]
> 
> Instead, how about this - could per-CPU mutexes be implemented?  In that 
> mode, mutexes wouldn't use atomic ops, because they'd only ever be used by 
> a specific processor, thereby eliminating the need for atomic ops.  The 
> second modification would be that they set a per-CPU flag somewhere which 
> would tell the scheduler not to reawaken the sleeping kernel thread unless 
> it was on the same CPU it started on.

In a word, yes.  Start with the _get_sleep_lock macro from sys/mutex.h
and make two changes: (1) inline the implementation of sched_pin() just
before the _obtain_lock() call and (2) replace the current implementation
of _obtain_lock() with a new implementation that is atomic with respect
to interrupts but not other processors.

A similar approach could be applied to unlock, starting with the
_rel_sleep_lock() macro.

Alan



More information about the cvs-all mailing list