Re: [PATCH bpf-next] libbpf : make libbpf_num_possible_cpus function thread safe

2019-07-30 Thread Jakub Kicinski
On Tue, 30 Jul 2019 15:24:47 -0700, Takshak Chahande wrote: > Having static variable `cpus` in libbpf_num_possible_cpus function without > guarding it with mutex makes this function thread-unsafe. > > If multiple threads accessing this function, in the current form; it > leads to incrementing the

[PATCH bpf-next] libbpf : make libbpf_num_possible_cpus function thread safe

2019-07-30 Thread Takshak Chahande
Having static variable `cpus` in libbpf_num_possible_cpus function without guarding it with mutex makes this function thread-unsafe. If multiple threads accessing this function, in the current form; it leads to incrementing the static variable value `cpus` in the multiple of total available CPUs.