John Baldwin wrote:
> On Saturday 25 February 2006 06:04, Kazuaki Oda wrote:
>   
>> Hi,
>>
>> When reading kern_switch.c, I noticed odd difference between !SMP and
>> SMP in maybe_preempt_in_ksegrp().
>>
>> In !SMP case:
>> =================================================================
>> #ifdef PREEMPTION
>> #ifndef FULL_PREEMPTION
>>      if (td->td_priority > PRI_MAX_ITHD) {
>>              running_thread->td_flags |= TDF_NEEDRESCHED;
>>              return;
>>      }
>> #endif /* FULL_PREEMPTION */
>> =================================================================
>>
>> In SMP case:
>> =================================================================
>> #ifdef PREEMPTION
>>
>> #if !defined(FULL_PREEMPTION)
>>      if (td->td_priority > PRI_MAX_ITHD) {
>>              running_thread->td_flags |= TDF_NEEDRESCHED;
>>      }
>> #endif /* ! FULL_PREEMPTION */
>> =================================================================
>>
>> Is there any reason not to return after setting TDF_NEEDRESCHED flag
>> in SMP case?  Because of this, we do context switch even if td's
>> priority is lower than PRI_MAX_ITHD.  And, I think, it is not
>> PREEMPTION, but FULL_PREEMPTION.
>>     
>
> Yes, that is a bug, but it only would affect multithreaded applications
> I think. 
I agree.
>  Also, the maybe_preempt_in_kseg() stuff doesn't handle idle
> priority threads correctly in the !FULL_PREEMPTION case (the maybe_preempt()
> function in !FULL_PREEMPTION always preempts _to_ interrupt threads and
> always preempts _from_ idle priority threads).
>
>   
yeah - but this only affects multi-threaded applications running on idle
priority.
( maybe_preempt_in_kseg() only preempts between threads from the same
process)

If nobody beats me to it I will try to commit changes (hopefully) early
next week.

Stephan
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to