The attached patch does a lock-break in copy_page_range() if needed, to reduce scheduling latencies. has been tested as part of the -VP patchset. Signed-off-by: Ingo Molnar --- linux/mm/memory.c.orig +++ linux/mm/memory.c @@ -337,6 +337,25 @@ cont_copy_pte_range_noset: } src_pte++; dst_pte++; + /* + * We are holding two locks at this point - + * any of them could generate latencies in + * another task on another CPU: + */ + if (need_resched() || + need_lockbreak(&src->page_table_lock) || + need_lockbreak(&dst->page_table_lock)) + { + pte_unmap_nested(src_pte); + pte_unmap(dst_pte); + spin_unlock(&src->page_table_lock); + spin_unlock(&dst->page_table_lock); + cond_resched(); + spin_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);