|
@@ -34,6 +34,7 @@
|
|
|
#include <linux/backing-dev.h>
|
|
|
#include <linux/compaction.h>
|
|
|
#include <linux/syscalls.h>
|
|
|
+#include <linux/compat.h>
|
|
|
#include <linux/hugetlb.h>
|
|
|
#include <linux/hugetlb_cgroup.h>
|
|
|
#include <linux/gfp.h>
|
|
@@ -1745,10 +1746,10 @@ static int do_pages_stat(struct mm_struct *mm, unsigned long nr_pages,
|
|
|
* Move a list of pages in the address space of the currently executing
|
|
|
* process.
|
|
|
*/
|
|
|
-SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,
|
|
|
- const void __user * __user *, pages,
|
|
|
- const int __user *, nodes,
|
|
|
- int __user *, status, int, flags)
|
|
|
+static int kernel_move_pages(pid_t pid, unsigned long nr_pages,
|
|
|
+ const void __user * __user *pages,
|
|
|
+ const int __user *nodes,
|
|
|
+ int __user *status, int flags)
|
|
|
{
|
|
|
struct task_struct *task;
|
|
|
struct mm_struct *mm;
|
|
@@ -1807,6 +1808,36 @@ out:
|
|
|
return err;
|
|
|
}
|
|
|
|
|
|
+SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,
|
|
|
+ const void __user * __user *, pages,
|
|
|
+ const int __user *, nodes,
|
|
|
+ int __user *, status, int, flags)
|
|
|
+{
|
|
|
+ return kernel_move_pages(pid, nr_pages, pages, nodes, status, flags);
|
|
|
+}
|
|
|
+
|
|
|
+#ifdef CONFIG_COMPAT
|
|
|
+COMPAT_SYSCALL_DEFINE6(move_pages, pid_t, pid, compat_ulong_t, nr_pages,
|
|
|
+ compat_uptr_t __user *, pages32,
|
|
|
+ const int __user *, nodes,
|
|
|
+ int __user *, status,
|
|
|
+ int, flags)
|
|
|
+{
|
|
|
+ const void __user * __user *pages;
|
|
|
+ int i;
|
|
|
+
|
|
|
+ pages = compat_alloc_user_space(nr_pages * sizeof(void *));
|
|
|
+ for (i = 0; i < nr_pages; i++) {
|
|
|
+ compat_uptr_t p;
|
|
|
+
|
|
|
+ if (get_user(p, pages32 + i) ||
|
|
|
+ put_user(compat_ptr(p), pages + i))
|
|
|
+ return -EFAULT;
|
|
|
+ }
|
|
|
+ return kernel_move_pages(pid, nr_pages, pages, nodes, status, flags);
|
|
|
+}
|
|
|
+#endif /* CONFIG_COMPAT */
|
|
|
+
|
|
|
#ifdef CONFIG_NUMA_BALANCING
|
|
|
/*
|
|
|
* Returns true if this is a safe migration target node for misplaced NUMA
|