Re: [patch] voluntary-preempt-2.6.8.1-P1

Ingo Molnar
2004-08-17T08:19:42Z

* Ingo Molnar <mingo@elte.hu> wrote:

> > Yes, Ingo identified an issue with copy_page_range, I don't think it's
> > fixed yet. See the voluntary-preempt-2.6.8.1-P0 thread.
>
> right, it's not fixed yet. It's not a trivial critical section - we
> are holding two locks and are mapping two atomic kmaps.

fortunately it's easier than i thought - neither the source pmd nor the
target pmd can go away so we can simply drop the locks, reschedule, and
remap. Does the patch below (ontop of -P3) fix the copy_page_range()
latencies you are seeing?

Ingo

--- linux/mm/memory.c.orig
+++ linux/mm/memory.c
@@ -337,6 +337,15 @@ cont_copy_pte_range_noset:
}
src_pte++;
dst_pte++;
+ if (voluntary_need_resched()) {
+ pte_unmap_nested(src_pte);
+ pte_unmap(dst_pte);
+ spin_unlock(&src->page_table_lock);
+ cond_resched_lock(&dst->page_table_lock);
+ spin_lock(&src->page_table_lock);
+ dst_pte = pte_offset_map(dst_pmd, address);
+ src_pte = pte_offset_map_nested(src_pmd, address);
+ }
} while ((unsigned long)src_pte & PTE_TABLE_MASK);
pte_unmap_nested(src_pte-1);
pte_unmap(dst_pte-1);