Lines Matching +full:cpu +full:- +full:nr
1 // SPDX-License-Identifier: GPL-2.0
17 "%s/devices/system/cpu/cpu%d/topology/core_siblings_list"
19 "%s/devices/system/cpu/cpu%d/topology/die_cpus_list"
21 "%s/devices/system/cpu/cpu%d/topology/thread_siblings_list"
23 "%s/devices/system/cpu/cpu%d/topology/core_cpus_list"
31 static int build_cpu_topology(struct cpu_topology *tp, int cpu) in build_cpu_topology() argument
39 int ret = -1; in build_cpu_topology()
42 sysfs__mountpoint(), cpu); in build_cpu_topology()
56 for (i = 0; i < tp->core_sib; i++) { in build_cpu_topology()
57 if (!strcmp(buf, tp->core_siblings[i])) in build_cpu_topology()
60 if (i == tp->core_sib) { in build_cpu_topology()
61 tp->core_siblings[i] = buf; in build_cpu_topology()
62 tp->core_sib++; in build_cpu_topology()
69 if (!tp->die_siblings) in build_cpu_topology()
73 sysfs__mountpoint(), cpu); in build_cpu_topology()
87 for (i = 0; i < tp->die_sib; i++) { in build_cpu_topology()
88 if (!strcmp(buf, tp->die_siblings[i])) in build_cpu_topology()
91 if (i == tp->die_sib) { in build_cpu_topology()
92 tp->die_siblings[i] = buf; in build_cpu_topology()
93 tp->die_sib++; in build_cpu_topology()
101 sysfs__mountpoint(), cpu); in build_cpu_topology()
102 if (access(filename, F_OK) == -1) { in build_cpu_topology()
104 sysfs__mountpoint(), cpu); in build_cpu_topology()
117 for (i = 0; i < tp->thread_sib; i++) { in build_cpu_topology()
118 if (!strcmp(buf, tp->thread_siblings[i])) in build_cpu_topology()
121 if (i == tp->thread_sib) { in build_cpu_topology()
122 tp->thread_siblings[i] = buf; in build_cpu_topology()
123 tp->thread_sib++; in build_cpu_topology()
141 for (i = 0 ; i < tp->core_sib; i++) in cpu_topology__delete()
142 zfree(&tp->core_siblings[i]); in cpu_topology__delete()
144 if (tp->die_sib) { in cpu_topology__delete()
145 for (i = 0 ; i < tp->die_sib; i++) in cpu_topology__delete()
146 zfree(&tp->die_siblings[i]); in cpu_topology__delete()
149 for (i = 0 ; i < tp->thread_sib; i++) in cpu_topology__delete()
150 zfree(&tp->thread_siblings[i]); in cpu_topology__delete()
168 if (access(filename, F_OK) == -1) in has_die_topology()
178 u32 nr, i, nr_addr; in cpu_topology__new() local
181 int ret = -1; in cpu_topology__new()
187 /* build online CPU map */ in cpu_topology__new()
194 nr = (u32)(ncpus & UINT_MAX); in cpu_topology__new()
196 sz = nr * sizeof(char *); in cpu_topology__new()
207 tp->core_siblings = addr; in cpu_topology__new()
210 tp->die_siblings = addr; in cpu_topology__new()
213 tp->thread_siblings = addr; in cpu_topology__new()
215 for (i = 0; i < nr; i++) { in cpu_topology__new()
233 static int load_numa_node(struct numa_topology_node *node, int nr) in load_numa_node() argument
239 int ret = -1; in load_numa_node()
243 node->node = (u32) nr; in load_numa_node()
246 sysfs__mountpoint(), nr); in load_numa_node()
249 return -1; in load_numa_node()
258 node->mem_total = mem; in load_numa_node()
260 node->mem_free = mem; in load_numa_node()
261 if (node->mem_total && node->mem_free) in load_numa_node()
269 sysfs__mountpoint(), nr); in load_numa_node()
273 return -1; in load_numa_node()
282 node->cpus = buf; in load_numa_node()
300 u32 nr, i; in numa_topology__new() local
322 nr = (u32) node_map->nr; in numa_topology__new()
324 tp = zalloc(sizeof(*tp) + sizeof(tp->nodes[0])*nr); in numa_topology__new()
328 tp->nr = nr; in numa_topology__new()
330 for (i = 0; i < nr; i++) { in numa_topology__new()
331 if (load_numa_node(&tp->nodes[i], node_map->map[i])) { in numa_topology__new()
349 for (i = 0; i < tp->nr; i++) in numa_topology__delete()
350 zfree(&tp->nodes[i].cpus); in numa_topology__delete()