Lines Matching refs:tp

450 static int build_cpu_topo(struct cpu_topo *tp, int cpu)  in build_cpu_topo()  argument
474 for (i = 0; i < tp->core_sib; i++) { in build_cpu_topo()
475 if (!strcmp(buf, tp->core_siblings[i])) in build_cpu_topo()
478 if (i == tp->core_sib) { in build_cpu_topo()
479 tp->core_siblings[i] = buf; in build_cpu_topo()
480 tp->core_sib++; in build_cpu_topo()
499 for (i = 0; i < tp->thread_sib; i++) { in build_cpu_topo()
500 if (!strcmp(buf, tp->thread_siblings[i])) in build_cpu_topo()
503 if (i == tp->thread_sib) { in build_cpu_topo()
504 tp->thread_siblings[i] = buf; in build_cpu_topo()
505 tp->thread_sib++; in build_cpu_topo()
516 static void free_cpu_topo(struct cpu_topo *tp) in free_cpu_topo() argument
520 if (!tp) in free_cpu_topo()
523 for (i = 0 ; i < tp->core_sib; i++) in free_cpu_topo()
524 zfree(&tp->core_siblings[i]); in free_cpu_topo()
526 for (i = 0 ; i < tp->thread_sib; i++) in free_cpu_topo()
527 zfree(&tp->thread_siblings[i]); in free_cpu_topo()
529 free(tp); in free_cpu_topo()
534 struct cpu_topo *tp; in build_cpu_topology() local
549 addr = calloc(1, sizeof(*tp) + 2 * sz); in build_cpu_topology()
553 tp = addr; in build_cpu_topology()
555 addr += sizeof(*tp); in build_cpu_topology()
556 tp->core_siblings = addr; in build_cpu_topology()
558 tp->thread_siblings = addr; in build_cpu_topology()
561 ret = build_cpu_topo(tp, i); in build_cpu_topology()
566 free_cpu_topo(tp); in build_cpu_topology()
567 tp = NULL; in build_cpu_topology()
569 return tp; in build_cpu_topology()
575 struct cpu_topo *tp; in write_cpu_topology() local
579 tp = build_cpu_topology(); in write_cpu_topology()
580 if (!tp) in write_cpu_topology()
583 ret = do_write(fd, &tp->core_sib, sizeof(tp->core_sib)); in write_cpu_topology()
587 for (i = 0; i < tp->core_sib; i++) { in write_cpu_topology()
588 ret = do_write_string(fd, tp->core_siblings[i]); in write_cpu_topology()
592 ret = do_write(fd, &tp->thread_sib, sizeof(tp->thread_sib)); in write_cpu_topology()
596 for (i = 0; i < tp->thread_sib; i++) { in write_cpu_topology()
597 ret = do_write_string(fd, tp->thread_siblings[i]); in write_cpu_topology()
602 free_cpu_topo(tp); in write_cpu_topology()