patch-2.4.22 linux-2.4.22/mm/mremap.c
Next file: linux-2.4.22/mm/oom_kill.c
Previous file: linux-2.4.22/mm/filemap.c
Back to the patch index
Back to the overall index
- Lines: 34
- Date:
2003-08-25 04:44:44.000000000 -0700
- Orig file:
linux-2.4.21/mm/mremap.c
- Orig date:
2001-09-20 20:31:26.000000000 -0700
diff -urN linux-2.4.21/mm/mremap.c linux-2.4.22/mm/mremap.c
@@ -177,11 +177,13 @@
}
if (!move_page_tables(current->mm, new_addr, addr, old_len)) {
+ unsigned long vm_locked = vma->vm_flags & VM_LOCKED;
+
if (allocated_vma) {
*new_vma = *vma;
new_vma->vm_start = new_addr;
new_vma->vm_end = new_addr+new_len;
- new_vma->vm_pgoff += (addr - vma->vm_start) >> PAGE_SHIFT;
+ new_vma->vm_pgoff += (addr-vma->vm_start) >> PAGE_SHIFT;
new_vma->vm_raend = 0;
if (new_vma->vm_file)
get_file(new_vma->vm_file);
@@ -189,12 +191,15 @@
new_vma->vm_ops->open(new_vma);
insert_vm_struct(current->mm, new_vma);
}
+
do_munmap(current->mm, addr, old_len);
+
current->mm->total_vm += new_len >> PAGE_SHIFT;
- if (new_vma->vm_flags & VM_LOCKED) {
+ if (vm_locked) {
current->mm->locked_vm += new_len >> PAGE_SHIFT;
- make_pages_present(new_vma->vm_start,
- new_vma->vm_end);
+ if (new_len > old_len)
+ make_pages_present(new_addr + old_len,
+ new_addr + new_len);
}
return new_addr;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)