[patch 38/39] [RFC] remap_file_pages protection support: avoid dirtying on read faults for NONUNIFORM pages

From: blaisorblade
Date: Fri Aug 12 2005 - 13:50:59 EST



From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx>

When installing pages on non-uniform VMA's, even for read faults we must
install them writable if the VMA is writable (we won't have a chance to fix
that). Normally, on write faults, we install the PTE as dirty (there's a
comment about 80386 on this), but maybe it's not needed here on read faults.

I've looked for more info about that comment - unfortunately, it's there
almost unchanged since 2.4.0, so I've found no info.

However, UML does depend on the old behaviour currently (trivial to cure,
anyway). And if other arch's don't have an hardware "dirty" bit, they'll
depend on this too.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx>
---

linux-2.6.git-paolo/mm/memory.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)

diff -puN mm/memory.c~rfp-fault-optim-risky mm/memory.c
--- linux-2.6.git/mm/memory.c~rfp-fault-optim-risky 2005-08-12 19:25:16.000000000 +0200
+++ linux-2.6.git-paolo/mm/memory.c 2005-08-12 19:25:16.000000000 +0200
@@ -1899,8 +1899,10 @@ retry:
* been set (we can have a writeable VMA with a read-only PTE),
* so we must set the *exact* permission on fault, and avoid
* calling do_wp_page on write faults. */
- if (write_access || unlikely(vma->vm_flags & VM_NONUNIFORM))
+ if (write_access)
entry = maybe_mkwrite(pte_mkdirty(entry), vma);
+ else if (unlikely(vma->vm_flags & VM_NONUNIFORM))
+ entry = maybe_mkwrite(entry, vma);
set_pte_at(mm, address, page_table, entry);
if (anon) {
lru_cache_add_active(new_page);
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/