Commit c6b6ef8bb05af632889c5536513b9f4004961f73

Authored by Lee Schermerhorn
Committed by Linus Torvalds
1 parent 7198f3c9b1

mempolicy: fix get_mempolicy() for relative and static nodes

Discovered while testing other mempolicy changes:

get_mempolicy() does not handle static/relative mode flags correctly.
Return the value that the user specified so that it can be restored
via set_mempolicy() if desired.

Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: Ravikiran Thirumalai <kiran@scalex86.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 7 additions and 3 deletions Side-by-side Diff

... ... @@ -806,9 +806,13 @@
806 806  
807 807 err = 0;
808 808 if (nmask) {
809   - task_lock(current);
810   - get_policy_nodemask(pol, nmask);
811   - task_unlock(current);
  809 + if (mpol_store_user_nodemask(pol)) {
  810 + *nmask = pol->w.user_nodemask;
  811 + } else {
  812 + task_lock(current);
  813 + get_policy_nodemask(pol, nmask);
  814 + task_unlock(current);
  815 + }
812 816 }
813 817  
814 818 out: