Skip to content

Commit

Permalink
Avoid libnuma.so dependency on util.o
Browse files Browse the repository at this point in the history
util.o is linked in the numactl binary, but not into other users.
numa_preferred used an util.o function. Switch it over to a private
copy.

Signed-off-by: Andi Kleen <andi@firstfloor.org>
  • Loading branch information
Andi Kleen committed Feb 25, 2022
1 parent bf0a0af commit 8e1e03c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion libnuma.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ numa_fini(void)
cleanup_node_cpu_mask_v2();
}

static int numa_find_first(struct bitmask *mask)
{
int i;
for (i = 0; i < mask->size; i++)
if (numa_bitmask_isbitset(mask, i))
return i;
return -1;
}

/*
* The following bitmask declarations, bitmask_*() routines, and associated
* _setbit() and _getbit() routines are:
Expand Down Expand Up @@ -1819,7 +1828,7 @@ static struct bitmask *__numa_preferred(void)

int numa_preferred(void)
{
return find_first(__numa_preferred());
return numa_find_first(__numa_preferred());
}

static void __numa_set_preferred(struct bitmask *bmp)
Expand Down

0 comments on commit 8e1e03c

Please sign in to comment.