• Andrew Morton's avatar
    [PATCH] consolidate the VMA splitting code · 5846fc6c
    Andrew Morton authored
    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.
    5846fc6c
mmap.c 33.7 KB