lkml.org 
[lkml]   [2004]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] rmap 28 remove_vm_struct
    The callers of remove_shared_vm_struct then proceed to do several
    more identical things: gather them together in remove_vm_struct.

    mmap.c | 31 +++++++++++--------------------
    1 files changed, 11 insertions(+), 20 deletions(-)

    --- rmap27/mm/mmap.c 2004-05-08 20:55:05.460548328 +0100
    +++ rmap28/mm/mmap.c 2004-05-08 20:55:16.547862800 +0100
    @@ -66,7 +66,7 @@ EXPORT_SYMBOL(vm_committed_space);
    /*
    * Requires inode->i_mapping->i_shared_lock
    */
    -static inline void __remove_shared_vm_struct(struct vm_area_struct *vma,
    +static void __remove_shared_vm_struct(struct vm_area_struct *vma,
    struct file *file, struct address_space *mapping)
    {
    if (vma->vm_flags & VM_DENYWRITE)
    @@ -83,9 +83,9 @@ static inline void __remove_shared_vm_st
    }

    /*
    - * Remove one vm structure from the inode's i_mapping address space.
    + * Remove one vm structure and free it.
    */
    -static void remove_shared_vm_struct(struct vm_area_struct *vma)
    +static void remove_vm_struct(struct vm_area_struct *vma)
    {
    struct file *file = vma->vm_file;

    @@ -95,6 +95,12 @@ static void remove_shared_vm_struct(stru
    __remove_shared_vm_struct(vma, file, mapping);
    spin_unlock(&mapping->i_shared_lock);
    }
    + if (vma->vm_ops && vma->vm_ops->close)
    + vma->vm_ops->close(vma);
    + if (file)
    + fput(file);
    + mpol_free(vma_policy(vma));
    + kmem_cache_free(vm_area_cachep, vma);
    }

    /*
    @@ -1164,14 +1170,7 @@ static void unmap_vma(struct mm_struct *
    area->vm_start < area->vm_mm->free_area_cache)
    area->vm_mm->free_area_cache = area->vm_start;

    - remove_shared_vm_struct(area);
    -
    - mpol_free(vma_policy(area));
    - if (area->vm_ops && area->vm_ops->close)
    - area->vm_ops->close(area);
    - if (area->vm_file)
    - fput(area->vm_file);
    - kmem_cache_free(vm_area_cachep, area);
    + remove_vm_struct(area);
    }

    /*
    @@ -1500,15 +1499,7 @@ void exit_mmap(struct mm_struct *mm)
    */
    while (vma) {
    struct vm_area_struct *next = vma->vm_next;
    - remove_shared_vm_struct(vma);
    - if (vma->vm_ops) {
    - if (vma->vm_ops->close)
    - vma->vm_ops->close(vma);
    - }
    - if (vma->vm_file)
    - fput(vma->vm_file);
    - mpol_free(vma_policy(vma));
    - kmem_cache_free(vm_area_cachep, vma);
    + remove_vm_struct(vma);
    vma = next;
    }
    }
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 14:03    [W:0.023 / U:29.760 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site