set_mempolicy(): limit maxnode to PROCESS_NUMA_MASK_BITS

This commit is contained in:
Balazs Gerofi
2016-12-08 20:48:12 +09:00
parent 202bfd9955
commit 7d13bfb14e
2 changed files with 10 additions and 4 deletions

View File

@ -166,7 +166,7 @@
#define NOPHYS ((uintptr_t)-1)
#define PROCESS_NUMA_MASK_BITS 64
#define PROCESS_NUMA_MASK_BITS 256
/*
* Both the MPOL_* mempolicy mode and the MPOL_F_* optional mode flags are

View File

@ -7400,7 +7400,9 @@ SYSCALL_DECLARE(mbind)
}
/* Verify NUMA mask */
for_each_set_bit(bit, numa_mask, maxnode) {
for_each_set_bit(bit, numa_mask,
maxnode < PROCESS_NUMA_MASK_BITS ?
maxnode : PROCESS_NUMA_MASK_BITS) {
if (bit >= ihk_mc_get_nr_numa_nodes()) {
dkprintf("%s: %d is bigger than # of NUMA nodes\n",
__FUNCTION__, bit);
@ -7703,7 +7705,9 @@ SYSCALL_DECLARE(set_mempolicy)
/* Verify NUMA mask */
valid_mask = 0;
for_each_set_bit(bit, numa_mask, maxnode) {
for_each_set_bit(bit, numa_mask,
maxnode < PROCESS_NUMA_MASK_BITS ?
maxnode : PROCESS_NUMA_MASK_BITS) {
if (bit >= ihk_mc_get_nr_numa_nodes()) {
dkprintf("%s: %d is bigger than # of NUMA nodes\n",
__FUNCTION__, bit);
@ -7725,7 +7729,9 @@ SYSCALL_DECLARE(set_mempolicy)
}
/* Update current mask by clearing non-requested nodes */
for_each_set_bit(bit, vm->numa_mask, maxnode) {
for_each_set_bit(bit, vm->numa_mask,
maxnode < PROCESS_NUMA_MASK_BITS ?
maxnode : PROCESS_NUMA_MASK_BITS) {
if (!test_bit(bit, numa_mask)) {
clear_bit(bit, vm->numa_mask);
}