diff options
author | Dimitri Sivanich <sivanich@sgi.com> | 2010-12-28 13:34:42 -0600 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2010-12-28 14:06:21 -0800 |
commit | 75c1c91cb92806f960fcd6e53d2a0c21f343081c (patch) | |
tree | f87fd2f7cf75b9d2b1180452120f8dd852d2c9b6 /arch/ia64/kernel/smp.c | |
parent | 90a8a73c06cc32b609a880d48449d7083327e11a (diff) | |
download | linux-stable-75c1c91cb92806f960fcd6e53d2a0c21f343081c.tar.gz linux-stable-75c1c91cb92806f960fcd6e53d2a0c21f343081c.tar.bz2 linux-stable-75c1c91cb92806f960fcd6e53d2a0c21f343081c.zip |
[IA64] eliminate race condition in smp_flush_tlb_mm
A race condition exists within smp_call_function_many() when called from
smp_flush_tlb_mm(). On rare occasions the cpu_vm_mask can be cleared
while smp_call_function_many is executing, occasionally resulting in a
hung process.
Make a copy of the mask prior to calling smp_call_function_many().
Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/kernel/smp.c')
-rw-r--r-- | arch/ia64/kernel/smp.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c index dabeefe21134..be450a3e9871 100644 --- a/arch/ia64/kernel/smp.c +++ b/arch/ia64/kernel/smp.c @@ -293,6 +293,7 @@ smp_flush_tlb_all (void) void smp_flush_tlb_mm (struct mm_struct *mm) { + cpumask_var_t cpus; preempt_disable(); /* this happens for the common case of a single-threaded fork(): */ if (likely(mm == current->active_mm && atomic_read(&mm->mm_users) == 1)) @@ -301,9 +302,15 @@ smp_flush_tlb_mm (struct mm_struct *mm) preempt_enable(); return; } - - smp_call_function_many(mm_cpumask(mm), - (void (*)(void *))local_finish_flush_tlb_mm, mm, 1); + if (!alloc_cpumask_var(&cpus, GFP_ATOMIC)) { + smp_call_function((void (*)(void *))local_finish_flush_tlb_mm, + mm, 1); + } else { + cpumask_copy(cpus, mm_cpumask(mm)); + smp_call_function_many(cpus, + (void (*)(void *))local_finish_flush_tlb_mm, mm, 1); + free_cpumask_var(cpus); + } local_irq_disable(); local_finish_flush_tlb_mm(mm); local_irq_enable(); |