Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libbpf: switch libbpf_num_possible_cpus() implementation to simpler sysconf(_SC_NPROCESSORS_CONF) call #383

Closed
anakryiko opened this issue Sep 17, 2021 · 6 comments
Labels
good first issue Good for newcomers improvement Improvements to existing functionality
Milestone

Comments

@anakryiko
Copy link
Member

There is no need to parse files. We need to double-check, but there is probably also no way that sysconf() can fail, which makes the API use simpler.

@anakryiko anakryiko added good first issue Good for newcomers improvement Improvements to existing functionality labels Sep 17, 2021
@anakryiko anakryiko added this to the libbpf-1.0 milestone Sep 17, 2021
@mfrw
Copy link

mfrw commented Sep 21, 2021

@anakryiko Can I take a stab at it ?

@anakryiko
Copy link
Member Author

Sure! Just keep in mind that libbpf changes have to go through kernel tree (bpf-next in this case), so please submit the patch to bpf@vger.kernel.org. See https://kernelnewbies.org/FirstKernelPatch and https://www.kernel.org/doc/html/latest/bpf/bpf_devel_QA.html if it will be your first kernel patch submission.

@mfrw
Copy link

mfrw commented Sep 21, 2021

One point, since sysconf sets the errno we probably can avoid using libbpf_err.
Is my understanding correct ?

Something like this.

@anakryiko
Copy link
Member Author

Let's not split discussion into two parts. Replied on mailing list.

kernel-patches-bot pushed a commit to kernel-patches/bpf that referenced this issue Sep 22, 2021
Simplify libbpf_num_possible_cpus by using sysconf(_SC_NPROCESSORS_CONF)
instead of parsing a file.
This patch is a part ([0]) of libbpf-1.0 milestone.

[0] Closes: libbpf/libbpf#383

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
tsipa pushed a commit to tsipa/bpf-next that referenced this issue Sep 22, 2021
Simplify libbpf_num_possible_cpus by using sysconf(_SC_NPROCESSORS_CONF)
instead of parsing a file.
This patch is a part ([0]) of libbpf-1.0 milestone.

[0] Closes: libbpf/libbpf#383

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
fengguang pushed a commit to 0day-ci/linux that referenced this issue Sep 22, 2021
Simplify libbpf_num_possible_cpus by using sysconf(_SC_NPROCESSORS_CONF)
instead of parsing a file.
This patch is a part ([0]) of libbpf-1.0 milestone.

[0] Closes: libbpf/libbpf#383

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
tsipa pushed a commit to tsipa/bpf-next that referenced this issue Sep 22, 2021
Simplify libbpf_num_possible_cpus by using sysconf(_SC_NPROCESSORS_CONF)
instead of parsing a file.
This patch is a part ([0]) of libbpf-1.0 milestone.

[0] Closes: libbpf/libbpf#383

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
kernel-patches-bot pushed a commit to kernel-patches/bpf that referenced this issue Sep 22, 2021
Simplify libbpf_num_possible_cpus by using sysconf(_SC_NPROCESSORS_CONF)
instead of parsing a file.
This patch is a part ([0]) of libbpf-1.0 milestone.

[0] Closes: libbpf/libbpf#383

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
@mfrw
Copy link

mfrw commented Sep 25, 2021

@anakryiko Should we probably close this issue ?

@anakryiko
Copy link
Member Author

We are not going to do that. https://lore.kernel.org/bpf/ef0f23d0-456a-70b0-1ef9-2615a5528278@iogearbox.net/ for explanation of why not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers improvement Improvements to existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants