lkml.org 
[lkml]   [2005]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[patch 12/18] remap_file_pages protection support: optimize install_file_pte for MAP_POPULATE
From
Date

From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

Add an optimization to install_file_pte: if the VMA is uniform (and thus we're
likely called by MAP_POPULATE), and the PTE was null, it will be installed
correctly if needed at fault time - we avoid thus touching the page tables,
but we must still do the walk...

The PTE could have a wrong value only if we are in a private VMA, and it was a
broken COW page, either installed or swapped. So, in subsequent patches we
even optimize away the walk.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---

linux-2.6.git-paolo/mm/fremap.c | 9 +++++++++
1 files changed, 9 insertions(+)

diff -puN mm/fremap.c~rfp-linear-optim-v2 mm/fremap.c
--- linux-2.6.git/mm/fremap.c~rfp-linear-optim-v2 2005-08-25 12:50:10.000000000 +0200
+++ linux-2.6.git-paolo/mm/fremap.c 2005-08-25 12:58:29.000000000 +0200
@@ -125,6 +125,9 @@ int install_file_pte(struct mm_struct *m
pud_t *pud;
pgd_t *pgd;
pte_t pte_val;
+ int uniform = !(vma->vm_flags & (VM_NONUNIFORM | VM_NONLINEAR));
+
+ BUG_ON(!uniform && !(vma->vm_flags & VM_SHARED));

pgd = pgd_offset(mm, addr);
spin_lock(&mm->page_table_lock);
@@ -140,6 +143,12 @@ int install_file_pte(struct mm_struct *m
pte = pte_alloc_map(mm, pmd, addr);
if (!pte)
goto err_unlock;
+ /*
+ * Skip uniform non-existent ptes:
+ */
+ err = 0;
+ if (uniform && pte_none(*pte))
+ goto err_unlock;

zap_pte(mm, vma, addr, pte);

_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-08-26 19:09    [W:0.045 / U:3.736 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site