patch-2.3.25 linux/mm/mlock.c

Next file: linux/mm/mmap.c
Previous file: linux/mm/memory.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.24/linux/mm/mlock.c linux/mm/mlock.c
@@ -7,6 +7,7 @@
 #include <linux/shm.h>
 #include <linux/mman.h>
 #include <linux/smp_lock.h>
+#include <linux/pagemap.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -35,7 +36,7 @@
 	if (n->vm_ops && n->vm_ops->open)
 		n->vm_ops->open(n);
 	vmlist_modify_lock(vma->vm_mm);
-	vma->vm_offset += end - vma->vm_start;
+	vma->vm_pgoff += (end - vma->vm_start) >> PAGE_SHIFT;
 	vma->vm_start = end;
 	insert_vm_struct(current->mm, n);
 	vmlist_modify_unlock(vma->vm_mm);
@@ -52,7 +53,7 @@
 		return -EAGAIN;
 	*n = *vma;
 	n->vm_start = start;
-	n->vm_offset += n->vm_start - vma->vm_start;
+	n->vm_pgoff += (n->vm_start - vma->vm_start) >> PAGE_SHIFT;
 	n->vm_flags = newflags;
 	if (n->vm_file)
 		get_file(n->vm_file);
@@ -82,7 +83,7 @@
 	*right = *vma;
 	left->vm_end = start;
 	right->vm_start = end;
-	right->vm_offset += right->vm_start - left->vm_start;
+	right->vm_pgoff += (right->vm_start - left->vm_start) >> PAGE_SHIFT;
 	vma->vm_flags = newflags;
 	if (vma->vm_file)
 		atomic_add(2, &vma->vm_file->f_count);
@@ -92,7 +93,7 @@
 		vma->vm_ops->open(right);
 	}
 	vmlist_modify_lock(vma->vm_mm);
-	vma->vm_offset += start - vma->vm_start;
+	vma->vm_pgoff += (start - vma->vm_start) >> PAGE_SHIFT;
 	vma->vm_start = start;
 	vma->vm_end = end;
 	vma->vm_flags = newflags;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)