]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - mm/nommu.c
Merge tag 'optee-bus-for-v5.9' of git://git.linaro.org/people/jens.wiklander/linux...
[mirror_ubuntu-hirsute-kernel.git] / mm / nommu.c
index dfae55f41901374d3aa1db9a70ba415e237d1293..cdcad5d61dd1949230b33cf60f177ed790eb7553 100644 (file)
@@ -172,11 +172,11 @@ static void *__vmalloc_user_flags(unsigned long size, gfp_t flags)
        if (ret) {
                struct vm_area_struct *vma;
 
-               down_write(&current->mm->mmap_sem);
+               mmap_write_lock(current->mm);
                vma = find_vma(current->mm, (unsigned long)ret);
                if (vma)
                        vma->vm_flags |= VM_USERMAP;
-               up_write(&current->mm->mmap_sem);
+               mmap_write_unlock(current->mm);
        }
 
        return ret;
@@ -433,7 +433,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
        /*
         * Ok, looks good - let it rip.
         */
-       flush_icache_range(mm->brk, brk);
+       flush_icache_user_range(mm->brk, brk);
        return mm->brk = brk;
 }
 
@@ -582,7 +582,7 @@ static void put_nommu_region(struct vm_region *region)
  * add a VMA into a process's mm_struct in the appropriate place in the list
  * and tree and add to the address space's page tree also if not an anonymous
  * page
- * - should be called with mm->mmap_sem held writelocked
+ * - should be called with mm->mmap_lock held writelocked
  */
 static void add_vma_to_mm(struct mm_struct *mm, struct vm_area_struct *vma)
 {
@@ -696,7 +696,7 @@ static void delete_vma(struct mm_struct *mm, struct vm_area_struct *vma)
 
 /*
  * look up the first VMA in which addr resides, NULL if none
- * - should be called with mm->mmap_sem at least held readlocked
+ * - should be called with mm->mmap_lock at least held readlocked
  */
 struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr)
 {
@@ -742,7 +742,7 @@ int expand_stack(struct vm_area_struct *vma, unsigned long address)
 
 /*
  * look up the first VMA exactly that exactly matches addr
- * - should be called with mm->mmap_sem at least held readlocked
+ * - should be called with mm->mmap_lock at least held readlocked
  */
 static struct vm_area_struct *find_vma_exact(struct mm_struct *mm,
                                             unsigned long addr,
@@ -1277,7 +1277,7 @@ share:
        /* we flush the region from the icache only when the first executable
         * mapping of it is made  */
        if (vma->vm_flags & VM_EXEC && !region->vm_icache_flushed) {
-               flush_icache_range(region->vm_start, region->vm_end);
+               flush_icache_user_range(region->vm_start, region->vm_end);
                region->vm_icache_flushed = true;
        }
 
@@ -1542,9 +1542,9 @@ int vm_munmap(unsigned long addr, size_t len)
        struct mm_struct *mm = current->mm;
        int ret;
 
-       down_write(&mm->mmap_sem);
+       mmap_write_lock(mm);
        ret = do_munmap(mm, addr, len, NULL);
-       up_write(&mm->mmap_sem);
+       mmap_write_unlock(mm);
        return ret;
 }
 EXPORT_SYMBOL(vm_munmap);
@@ -1631,9 +1631,9 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
 {
        unsigned long ret;
 
-       down_write(&current->mm->mmap_sem);
+       mmap_write_lock(current->mm);
        ret = do_mremap(addr, old_len, new_len, flags, new_addr);
-       up_write(&current->mm->mmap_sem);
+       mmap_write_unlock(current->mm);
        return ret;
 }
 
@@ -1705,7 +1705,7 @@ int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
        struct vm_area_struct *vma;
        int write = gup_flags & FOLL_WRITE;
 
-       if (down_read_killable(&mm->mmap_sem))
+       if (mmap_read_lock_killable(mm))
                return 0;
 
        /* the access must start within one of the target process's mappings */
@@ -1728,7 +1728,7 @@ int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
                len = 0;
        }
 
-       up_read(&mm->mmap_sem);
+       mmap_read_unlock(mm);
 
        return len;
 }