Skip to content

Commit

Permalink
numactl: Simplify preferred selection
Browse files Browse the repository at this point in the history
This will help consolidate preferred and preferred-many usage.

Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
Signed-off-by: Feng Tang <feng.tang@intel.com>
  • Loading branch information
Ben Widawsky authored and andikleen committed Dec 9, 2021
1 parent 7213fe5 commit 5862e0e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions numactl.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ static struct bitmask *numactl_parse_nodestring(char *s, int flag)

int main(int ac, char **av)
{
int c, i, nnodes=0;
int c;
long node=-1;
char *end;
char shortopts[array_len(opts)*2 + 1];
Expand Down Expand Up @@ -535,21 +535,16 @@ int main(int ac, char **av)
printf ("<%s> is invalid\n", optarg);
usage();
}
for (i=0; i<mask->size; i++) {
if (numa_bitmask_isbitset(mask, i)) {
node = i;
nnodes++;
}
}
if (nnodes != 1)
if (numa_bitmask_weight(mask) != 1)
usage();
errno = 0;
did_node_cpu_parse = 1;
numa_set_bind_policy(0);
if (shmfd >= 0)
numa_tonode_memory(shmptr, shmlen, node);
else
numa_set_preferred(node);
numa_set_preferred(find_first(mask));
numa_bitmask_free(mask);
checkerror("setting preferred node");
break;
case 'l': /* --local */
Expand Down

0 comments on commit 5862e0e

Please sign in to comment.