Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174845
b: refs/heads/master
c: 1a0ef85
h: refs/heads/master
i:
  174843: 88f786b
v: v3
  • Loading branch information
Al Viro committed Dec 11, 2009
1 parent 37c6541 commit d6b7b0b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ecc1a8993751de4e82eb18640d631dae1f626bd6
refs/heads/master: 1a0ef85f84feb13f07b604fcf5b90ef7c2b5c82f
16 changes: 12 additions & 4 deletions trunk/mm/mremap.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,17 @@ static unsigned long mremap_to(unsigned long addr,
return ret;
}

static int vma_expandable(struct vm_area_struct *vma, unsigned long delta)
{
unsigned long max_addr = TASK_SIZE;
if (vma->vm_next)
max_addr = vma->vm_next->vm_start;
if (max_addr - vma->vm_end < delta)
return 0;
/* we need to do arch-specific checks here */
return 1;
}

/*
* Expand (or shrink) an existing mapping, potentially moving it at the
* same time (controlled by the MREMAP_MAYMOVE flag and available VM space)
Expand Down Expand Up @@ -430,11 +441,8 @@ unsigned long do_mremap(unsigned long addr,
/* old_len exactly to the end of the area..
*/
if (old_len == vma->vm_end - addr) {
unsigned long max_addr = TASK_SIZE;
if (vma->vm_next)
max_addr = vma->vm_next->vm_start;
/* can we just expand the current mapping? */
if (max_addr - addr >= new_len) {
if (vma_expandable(vma, new_len - old_len)) {
int pages = (new_len - old_len) >> PAGE_SHIFT;

vma_adjust(vma, vma->vm_start,
Expand Down

0 comments on commit d6b7b0b

Please sign in to comment.