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

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

: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.
:
:cheers
:   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:

	MONITOR
	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
    interrupts.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Detangle lwkt_switch() and the idle thread and consolida..., Matthew Dillon, (Mon Sep 3, 12:59 pm)
Re: Detangle lwkt_switch() and the idle thread and consolida..., Simon 'corecode' Schubert..., (Mon Sep 3, 1:20 pm)