提交 724746b1 编写于 作者: J Jens Axboe 提交者: Joseph Qi

mm: make do_madvise() available internally

to #26323588

commit db08ca25253d56f1f76eb4b3fe32a7ac1fbab741 upstream.

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: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Acked-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 f6f35684
...@@ -2411,6 +2411,7 @@ extern unsigned long do_mmap(struct file *file, unsigned long addr, ...@@ -2411,6 +2411,7 @@ extern unsigned long do_mmap(struct file *file, unsigned long addr,
struct list_head *uf); struct list_head *uf);
extern int do_munmap(struct mm_struct *, unsigned long, size_t, extern int do_munmap(struct mm_struct *, unsigned long, size_t,
struct list_head *uf); struct list_head *uf);
extern int do_madvise(unsigned long start, size_t len_in, int behavior);
static inline unsigned long static inline unsigned long
do_mmap_pgoff(struct file *file, unsigned long addr, do_mmap_pgoff(struct file *file, unsigned long addr,
......
...@@ -1082,7 +1082,7 @@ madvise_behavior_valid(int behavior) ...@@ -1082,7 +1082,7 @@ madvise_behavior_valid(int behavior)
* -EBADF - map exists, but area maps something that isn't a file. * -EBADF - map exists, but area maps something that isn't a file.
* -EAGAIN - a kernel resource was temporarily unavailable. * -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; unsigned long end, tmp;
struct vm_area_struct *vma, *prev; struct vm_area_struct *vma, *prev;
...@@ -1177,3 +1177,8 @@ SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior) ...@@ -1177,3 +1177,8 @@ SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior)
return error; return error;
} }
SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior)
{
return do_madvise(start, len_in, behavior);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册