aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-04-20 19:20:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-04-20 20:29:13 -0400
commita46ef99d80817a167477ed1c8b4d90ee0c2e726f (patch)
tree3d8c980c627e8b9c009dbf63628a9be8b8d1069f /mm
parente4eb1ff61b323d6141614e5458a1f53c7046ff8e (diff)
VM: add "vm_munmap()" helper function
Like the vm_brk() function, this is the same as "do_munmap()", except it does the VM locking for the caller. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/mmap.c15
-rw-r--r--mm/nommu.c9
2 files changed, 16 insertions, 8 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index df51891c8646..4af45f519f19 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2107,21 +2107,24 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
2107 2107
2108 return 0; 2108 return 0;
2109} 2109}
2110
2111EXPORT_SYMBOL(do_munmap); 2110EXPORT_SYMBOL(do_munmap);
2112 2111
2113SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) 2112int vm_munmap(struct mm_struct *mm, unsigned long start, size_t len)
2114{ 2113{
2115 int ret; 2114 int ret;
2116 struct mm_struct *mm = current->mm;
2117
2118 profile_munmap(addr);
2119 2115
2120 down_write(&mm->mmap_sem); 2116 down_write(&mm->mmap_sem);
2121 ret = do_munmap(mm, addr, len); 2117 ret = do_munmap(mm, start, len);
2122 up_write(&mm->mmap_sem); 2118 up_write(&mm->mmap_sem);
2123 return ret; 2119 return ret;
2124} 2120}
2121EXPORT_SYMBOL(vm_munmap);
2122
2123SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
2124{
2125 profile_munmap(addr);
2126 return vm_munmap(current->mm, addr, len);
2127}
2125 2128
2126static inline void verify_mm_writelocked(struct mm_struct *mm) 2129static inline void verify_mm_writelocked(struct mm_struct *mm)
2127{ 2130{
diff --git a/mm/nommu.c b/mm/nommu.c
index 634193324a6b..11a69b22bd4b 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1709,16 +1709,21 @@ erase_whole_vma:
1709} 1709}
1710EXPORT_SYMBOL(do_munmap); 1710EXPORT_SYMBOL(do_munmap);
1711 1711
1712SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) 1712int vm_munmap(struct mm_struct *mm, unsigned long addr, size_t len)
1713{ 1713{
1714 int ret; 1714 int ret;
1715 struct mm_struct *mm = current->mm;
1716 1715
1717 down_write(&mm->mmap_sem); 1716 down_write(&mm->mmap_sem);
1718 ret = do_munmap(mm, addr, len); 1717 ret = do_munmap(mm, addr, len);
1719 up_write(&mm->mmap_sem); 1718 up_write(&mm->mmap_sem);
1720 return ret; 1719 return ret;
1721} 1720}
1721EXPORT_SYMBOL(vm_munmap);
1722
1723SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
1724{
1725 return vm_munmap(current->mm, addr, len);
1726}
1722 1727
1723/* 1728/*
1724 * release all the mappings made in a process's VM space 1729 * release all the mappings made in a process's VM space