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 11/18] remap_file_pages protection support: also set VM_NONLINEAR on nonuniform VMAs
From
Date

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

To simplify the VM code, and to reflect expected application usage, we decide
to also set VM_NONLINEAR when setting VM_NONUNIFORM. Otherwise, we'd have to
possibly save nonlinear PTEs even on paths which cope with linear VMAs. It's
possible, but intrusive (it's done in one of the next patches).

Obviously, this has a performance cost, since we potentially have to handle a
linear VMA with nonlinear handling code. But I don't know of any application
which might have this usage.

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

linux-2.6.git-paolo/mm/fremap.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)

diff -puN mm/fremap.c~rfp-nonuniform-implies-nonlinear mm/fremap.c
--- linux-2.6.git/mm/fremap.c~rfp-nonuniform-implies-nonlinear 2005-08-25 12:50:00.000000000 +0200
+++ linux-2.6.git-paolo/mm/fremap.c 2005-08-25 12:50:00.000000000 +0200
@@ -246,8 +246,9 @@ retry:
if (!vma->vm_private_data ||
(vma->vm_flags & (VM_NONLINEAR|VM_RESERVED))) {
/* Must set VM_NONLINEAR before any pages are populated. */
- if (pgoff != linear_page_index(vma, start) &&
- !(vma->vm_flags & VM_NONLINEAR)) {
+ if (!(vma->vm_flags & VM_NONLINEAR) &&
+ (pgoff != linear_page_index(vma, start) ||
+ pgprot_val(pgprot) != pgprot_val(vma->vm_page_prot))) {
if (!(vma->vm_flags & VM_SHARED))
goto out_unlock;
if (!has_write_lock) {
@@ -264,19 +265,19 @@ retry:
vma_nonlinear_insert(vma, &mapping->i_mmap_nonlinear);
flush_dcache_mmap_unlock(mapping);
spin_unlock(&mapping->i_mmap_lock);
- }

- if (pgprot_val(pgprot) != pgprot_val(vma->vm_page_prot) &&
- !(vma->vm_flags & VM_NONUNIFORM)) {
- if (!(vma->vm_flags & VM_SHARED))
- goto out_unlock;
- if (!has_write_lock) {
- up_read(&mm->mmap_sem);
- down_write(&mm->mmap_sem);
- has_write_lock = 1;
- goto retry;
+ if (!(vma->vm_flags & VM_NONUNIFORM) &&
+ pgprot_val(pgprot) != pgprot_val(vma->vm_page_prot)) {
+ if (!(vma->vm_flags & VM_SHARED))
+ goto out_unlock;
+ if (!has_write_lock) {
+ up_read(&mm->mmap_sem);
+ down_write(&mm->mmap_sem);
+ has_write_lock = 1;
+ goto retry;
+ }
+ vma->vm_flags |= VM_NONUNIFORM;
}
- vma->vm_flags |= VM_NONUNIFORM;
}

/* Do NOT hold the write lock while doing any I/O, nor when
_
-
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:05    [W:0.042 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site