[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <952dfc9f-c552-6c48-7cb5-f1df2b752a56@iogearbox.net>
Date: Thu, 31 Jan 2019 23:26:48 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: Martynas Pumputis <m@...bda.lt>, netdev@...r.kernel.org
Cc: ys114321@...il.com, ast@...nel.org
Subject: Re: [PATCH v2 bpf] bpf: selftests: handle sparse CPU allocations
On 01/31/2019 10:19 AM, Martynas Pumputis wrote:
> Previously, bpf_num_possible_cpus() had a bug when calculating a
> number of possible CPUs in the case of sparse CPU allocations, as
> it was considering only the first range or element of
> /sys/devices/system/cpu/possible.
>
> E.g. in the case of "0,2-3" (CPU 1 is not available), the function
> returned 1 instead of 3.
>
> This patch fixes the function by making it parse all CPU ranges and
> elements.
>
> Signed-off-by: Martynas Pumputis <m@...bda.lt>
>
> ---
> Testing of the patch: https://gist.github.com/brb/5369b5cfd08babb80cf2c4081dc19762
> ---
> tools/testing/selftests/bpf/bpf_util.h | 31 +++++++++++++++++---------
> 1 file changed, 21 insertions(+), 10 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/bpf_util.h b/tools/testing/selftests/bpf/bpf_util.h
> index 315a44fa32af..442c3ab2d688 100644
> --- a/tools/testing/selftests/bpf/bpf_util.h
> +++ b/tools/testing/selftests/bpf/bpf_util.h
> @@ -9,11 +9,12 @@
>
> static inline unsigned int bpf_num_possible_cpus(void)
> {
> +
> static const char *fcpu = "/sys/devices/system/cpu/possible";
Applied and removed above whitespace while at it, thanks!
Powered by blists - more mailing lists