Detangle lwkt_switch() and the idle thread and consolidate sleep variables

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Mon Sep 3 10:27:08 PDT 2007


Matthew Dillon wrote:
    I wouldn't worry too much about tokens or the MP lock.  It probably isn't
    worth the effort to make those MWAITable because the scheduler
    interactions are fairly complex.  If the scheduler can't get the tokens
    or MP lock required for a thread it continues to look for other runnable
    threads.  If it can't find any it loops to the top and tries again.  If
    multiple runnable threads were skipped due to not being able to get tokens
    or the MP lock there is no easy way to use MWAIT.
That's exactly my concern.  I guess we don't use so many tokens anymore, 
but as long as we use the MP lock, we'll have this issue.  And it would 
be nice if we could use WMAIT in this case.

    Then we can use MONITOR and MWAIT in both the spinlock contended
    procedure and in the idle loop without having to physically disable
    interrupts.
Yes, we should even use this directly, without doing this backoff dance. 
 There is no sense in running NOPs if we could instead simply wait 
until the lock gets updated.

However the code right now doesn't look like it was written with this in 
mind :)

cheers
  simon




More information about the Kernel mailing list