Skip to content

Commit

Permalink
libnuma: Fix incorrect print and exit of numa_preferred/_many APIs
Browse files Browse the repository at this point in the history
Only when policy is preferred, numa_bitmask_weight will be judged,
because mbind and preferred_many support multiple nodes.

fixes: 87c6834("libnuma: Convert preferred node into a mask")

Signed-off-by: Chunsheng Luo <luochunsheng@ustc.edu>
  • Loading branch information
luochenglcs authored and andikleen committed Jan 26, 2024
1 parent e763e8c commit 00dd4c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libnuma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,7 @@ static struct bitmask *__numa_preferred(void)
policy != MPOL_BIND)
return bmp;

if (numa_bitmask_weight(bmp) > 1) {
if (policy == MPOL_PREFERRED && numa_bitmask_weight(bmp) > 1) {
errno = EINVAL;
numa_error(__FILE__);
}
Expand Down

0 comments on commit 00dd4c3

Please sign in to comment.