aboutsummaryrefslogtreecommitdiff
path: root/mm/memory.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-08-30 13:32:29 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-30 13:32:29 -0400
commited735ccbefaf7e5e3ef61418f7e209b8c59308a7 (patch)
treeb8cc69814d2368b08d0a84c8da0c12028bd04867 /mm/memory.c
parent39fbe47377062200acc26ea0ccef223b4399a82c (diff)
parentd8971fcb702e24d1e22c77fd1772f182ffee87e3 (diff)
Merge HEAD from /spare/repo/linux-2.6/.git
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c
index e046b7e4b53..a596c117224 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -498,6 +498,17 @@ int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
unsigned long addr = vma->vm_start;
unsigned long end = vma->vm_end;
+ /*
+ * Don't copy ptes where a page fault will fill them correctly.
+ * Fork becomes much lighter when there are big shared or private
+ * readonly mappings. The tradeoff is that copy_page_range is more
+ * efficient than faulting.
+ */
+ if (!(vma->vm_flags & (VM_HUGETLB|VM_NONLINEAR|VM_RESERVED))) {
+ if (!vma->anon_vma)
+ return 0;
+ }
+
if (is_vm_hugetlb_page(vma))
return copy_hugetlb_page_range(dst_mm, src_mm, vma);