]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm: make do_madvise() available internally
authorJens Axboe <axboe@kernel.dk>
Thu, 26 Dec 2019 05:14:54 +0000 (22:14 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 21 Jan 2020 00:04:02 +0000 (17:04 -0700)
This is in preparation for enabling this functionality through io_uring.
Add a helper that is just exporting what sys_madvise() does, and have the
system call use it.

No functional changes in this patch.

Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/mm.h
mm/madvise.c

index cfaa8feecfe86b9d340ac0bdfbd904656f9fb7c1..b4ba5b3bb54b4366f1ae696380103a8ee26ab79b 100644 (file)
@@ -2328,6 +2328,7 @@ extern int __do_munmap(struct mm_struct *, unsigned long, size_t,
                       struct list_head *uf, bool downgrade);
 extern int do_munmap(struct mm_struct *, unsigned long, size_t,
                     struct list_head *uf);
+extern int do_madvise(unsigned long start, size_t len_in, int behavior);
 
 static inline unsigned long
 do_mmap_pgoff(struct file *file, unsigned long addr,
index bcdb6a04278794ca97eea24cb59e8b7f04ab7111..43b47d3fae02e1cf86c0b9a98c5ce16471874841 100644 (file)
@@ -1044,7 +1044,7 @@ madvise_behavior_valid(int behavior)
  *  -EBADF  - map exists, but area maps something that isn't a file.
  *  -EAGAIN - a kernel resource was temporarily unavailable.
  */
-SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior)
+int do_madvise(unsigned long start, size_t len_in, int behavior)
 {
        unsigned long end, tmp;
        struct vm_area_struct *vma, *prev;
@@ -1141,3 +1141,8 @@ out:
 
        return error;
 }
+
+SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior)
+{
+       return do_madvise(start, len_in, behavior);
+}