DragonFly kernel List (threaded) for 2007-09
DragonFly BSD
DragonFly kernel List (threaded) for 2007-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

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

From: "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx>
Date: Mon, 03 Sep 2007 19:20:22 +0200

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

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


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]