TDF_NEEDRESCHED when extending pcb on x86

Denis Ustimenko denus at ngs.ru
Tue Mar 1 22:04:40 GMT 2005


John Baldwin wrote:
> On Monday 28 February 2005 07:06 pm, Peter Wemm wrote:
> 
>>On Monday 28 February 2005 02:57 pm, Denis Ustimenko wrote:
>>
>>>The problem occurs when we extend pcb and set TDF_NEEDRESCHED bit hoping
>>>that thread will be rescheduled and new TSS will be loaded. But
>>>sched_switch function skips cpu_switch when thread was not changed and
>>>ltr is not executed.
>>
>>I think it would be better to fix the semantics of TDF_NEEDRESCHED.  I was
>>thinking that mi_switch could negate the cpu_switch optimization if
>>TDF_NEEDRESCHED was set.  That would avoid duplicating the internal
>>knowledge of the pcb/tss/etc handling in this code.
> 
> 
> Forcing a context switch is a rather round-about way of getting ltr to be 
> executed though.  We already have intimate knowledge of TSS, etc. in this 
> file anyway, so I wonder if just doing the ltr() directly is the better 
> approach?
> 

Yes, John, I think it's better to load TR directly. Usage of 
TDF_NEEDRESCHED for loading TR is the only platform specific resort of 
this bit, so elimination of it makes design more clear and we do not 
need drop out cpu_switch optimization.

-- 
Best regards
Denis


More information about the freebsd-hackers mailing list