aboutsummaryrefslogtreecommitdiff
path: root/scripts/bpf_helpers_doc.py
diff options
context:
space:
mode:
authorTakshak Chahande <[email protected]>2019-07-31 15:10:55 -0700
committerAlexei Starovoitov <[email protected]>2019-07-31 20:35:19 -0700
commit56fbc24116f458a0ea48f9f37fe770fd791042d9 (patch)
tree17d137a6c297c88c4ad99dddf76b382ab9db9b42 /scripts/bpf_helpers_doc.py
parent5d01ab7bac467edfc530e6ccf953921def935c62 (diff)
libbpf : make libbpf_num_possible_cpus function thread safe
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. Used local stack variable to calculate the number of possible CPUs and then updated the static variable using WRITE_ONCE(). Changes since v1: * added stack variable to calculate cpus * serialized static variable update using WRITE_ONCE() * fixed Fixes tag Fixes: 6446b3155521 ("bpf: add a new API libbpf_num_possible_cpus()") Signed-off-by: Takshak Chahande <[email protected]> Acked-by: Andrey Ignatov <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'scripts/bpf_helpers_doc.py')
0 files changed, 0 insertions, 0 deletions