Thread (30 messages) 30 messages, 6 authors, 2005-07-05

Re: [PATCH] 8xx: get_mmu_context() for (very) FEW_CONTEXTS and KERNEL_PREEMPT race/starvation issue

From: Marcelo Tosatti <hidden>
Date: 2005-06-29 21:46:54

Hi!

On Wed, Jun 29, 2005 at 05:25:33PM -0400, Guillaume Autran wrote:
In that case, what happen when a higher priority task steal the context 
of the lower priority task after get_mmu_context() but before 
set_mmu_context() ?
Then when the lower priority task resumes, its context may no longer be 
valid...
Do I get this right ?
Yep... but its OK and expected for the "lower prio task" in question to have
its context invalidated: In this case it will call get_mmu_context() again
and reserve the next one available before executing.
I'm going to do like this instead of my previous attempt:

       /* Setup new userspace context */
       preempt_disable();
       get_mmu_context(next);
       set_context(next->context, next->pgd);
       preempt_enable();

To make sure we don't loose our context in between.
There should be no need - the window for the race is inside
get_mmu_context().

ie. It should be safe to preempt after setting "next_mm_context". 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help