[PATCH 2/2] libbpf: get num cpus sysfs path only when need

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Carlos Rodriguez-Fernandez <carlosrodrifernandez@xxxxxxxxx>
---
 src/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libbpf.c b/src/libbpf.c
index e42d252..a2133b5 100644
--- a/src/libbpf.c
+++ b/src/libbpf.c
@@ -12629,7 +12629,6 @@ static const char *cpu_topology_sysfs_path_by_type(const CPU_TOPOLOGY_SYSFS_TYPE
 
 int libbpf_num_cpus_by_topology_sysfs_type(const CPU_TOPOLOGY_SYSFS_TYPE type)
 {
-	const char *fcpu = cpu_topology_sysfs_path_by_type(type);
 	static int cpus[NUM_TYPES];
 	int err, n, i, tmp_cpus;
 	bool *mask;
@@ -12638,6 +12637,7 @@ int libbpf_num_cpus_by_topology_sysfs_type(const CPU_TOPOLOGY_SYSFS_TYPE type)
 	if (tmp_cpus > 0)
 		return tmp_cpus;
 
+	const char *fcpu = cpu_topology_sysfs_path_by_type(type);
 	err = parse_cpu_mask_file(fcpu, &mask, &n);
 	if (err)
 		return libbpf_err(err);
-- 
2.41.0





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux