From: Christoph Lameter Date: Wed, 1 Mar 2006 00:58:57 +0000 (-0800) Subject: [PATCH] Fix sys_migrate_pages: Move all pages when invoked from root X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=511030bcd24119fa3759ef3f914d354e107ef839;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git [PATCH] Fix sys_migrate_pages: Move all pages when invoked from root Currently sys_migrate_pages only moves pages belonging to a process. This is okay when invoked from a regular user. But if invoked from root it should move all pages as documented in the migrate_pages manpage. Signed-off-by: Christoph Lameter Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 67af4cea1e23..5643cfed6b0f 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -954,7 +954,8 @@ asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode, goto out; } - err = do_migrate_pages(mm, &old, &new, MPOL_MF_MOVE); + err = do_migrate_pages(mm, &old, &new, + capable(CAP_SYS_ADMIN) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE); out: mmput(mm); return err;