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: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 3 Sep 2007 09:59:41 -0700 (PDT)

:As Joerg already wrote, there are many conditions that will trigger the 
:monitor.  Interrupts etc are one of these, so we can execute with 
:interrupts enabled.  I was just curious how we could wait only on a 
:single variable, even if we are waiting for multiple tokens and the mplock.
:   simon

    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.

    Only spinlocks and the idle loop are easily MWAITable.  If an interrupt
    causes MWAIT to return immediately, that is in this situation:

	check pending interrupts
		<---------- interrupt occurs here
	MWAIT	(must return immediately and not wait)

    Then we can use MONITOR and MWAIT in both the spinlock contended
    procedure and in the idle loop without having to physically disable

					Matthew Dillon 

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