summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2002-09-17 06:35:47 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-09-17 06:35:47 -0700
commit5846fc6c31162234e88bdfd91548b1cf0d2cebbd (patch)
tree39c8260611dc81aa075ef24b4702f690847e4ed5 /include
parentc89a8badb450afd37d1b7565846b1f485b2d0311 (diff)
[PATCH] consolidate the VMA splitting code
Patch from Christoph Hellwig. 250 lines of code go away. The three syscalls madvice/mlock/mprotect all change attributes of memory regions. These attributes are stored in vm_area_structs (VMAs). The current code for those syscalls does this by having four subroutines each, for changing a whole VMA, one for just setting new flags if a full VMA is affected, one that creates a new VMA in the right part of the old one and sets the flags there, one for the left part, and one that splits of both the left and the right part and sets the new flags in the middle. This patch makes those routines create new VMAs on the left and on te right hand first and then always setting the flags in the old VMA. Together with using a library function (split_vma) to to the split this simplies the code and makes it more readable. As a side affect it fixes some VM accounting bugs observed by Hugh Dickins.
Diffstat (limited to 'include')
-rw-r--r--include/linux/mm.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e33d3f2bd080..3b7f9ba55dc0 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -504,6 +504,8 @@ extern int expand_stack(struct vm_area_struct * vma, unsigned long address);
extern struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr);
extern struct vm_area_struct * find_vma_prev(struct mm_struct * mm, unsigned long addr,
struct vm_area_struct **pprev);
+extern int split_vma(struct mm_struct * mm, struct vm_area_struct * vma,
+ unsigned long addr, int new_below);
/* Look up the first VMA which intersects the interval start_addr..end_addr-1,
NULL if none. Assume start_addr < end_addr. */