mm: fixed nodemask args in set_mempolicy()

inside oom0[2|4], ksm0[2|4] cases, they are running under
numa system, and allocte memory in the second numa node,
set nodemask 2, which indicates all memory allocated in
node1, but when a numa system don't have node1, these cases
will failed, such like the box, available nodes: (0,2,4,7)

 [root@hp-magnycours-01 oom]# ./oom02
 oom02       0  TINFO  :  set overcommit_memory to 1
 oom02       0  TINFO  :  process mempolicy.
 oom02       0  TINFO  :  start normal OOM testing.
 oom02       0  TINFO  :  expected victim is 9112.
 oom02       1  TBROK  :  set_mempolicy: errno=EINVAL(22): Invalid argument
 oom02       2  TBROK  :  Remaining cases broken
 oom02       0  TINFO  :  set overcommit_memory to 0
 oom02       1  TFAIL  :  the victim unexpectedly failed: 512
 oom02       0  TINFO  :  start OOM testing for mlocked pages.
 ...

the patch fixed the above issue.

Also inside cpuset01 case, depend on the reproducer, mem hog thread
allocated memory on *all* nodes, but 'nmask += exp2f(i);' can't
do that, and the patch fixed it.

Signed-off-by: Zhouping Liu <zliu@redhat.com>
Reviewed-by: Caspar Zhang <caspar@casparzhang.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
4 files changed