Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf thread: Rename thread->mg to thread->maps

One more step on the merge of 'struct maps' with 'struct map_groups'.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-69vcr8pubpym90skxhmbwhiw@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+49 -49
+1 -1
tools/perf/arch/arm/tests/dwarf-unwind.c
··· 26 26 27 27 sp = (unsigned long) regs[PERF_REG_ARM_SP]; 28 28 29 - map = maps__find(thread->mg, (u64)sp); 29 + map = maps__find(thread->maps, (u64)sp); 30 30 if (!map) { 31 31 pr_debug("failed to get stack map\n"); 32 32 free(buf);
+1 -1
tools/perf/arch/arm64/tests/dwarf-unwind.c
··· 26 26 27 27 sp = (unsigned long) regs[PERF_REG_ARM64_SP]; 28 28 29 - map = maps__find(thread->mg, (u64)sp); 29 + map = maps__find(thread->maps, (u64)sp); 30 30 if (!map) { 31 31 pr_debug("failed to get stack map\n"); 32 32 free(buf);
+1 -1
tools/perf/arch/powerpc/tests/dwarf-unwind.c
··· 27 27 28 28 sp = (unsigned long) regs[PERF_REG_POWERPC_R1]; 29 29 30 - map = maps__find(thread->mg, (u64)sp); 30 + map = maps__find(thread->maps, (u64)sp); 31 31 if (!map) { 32 32 pr_debug("failed to get stack map\n"); 33 33 free(buf);
+1 -1
tools/perf/arch/x86/tests/dwarf-unwind.c
··· 27 27 28 28 sp = (unsigned long) regs[PERF_REG_X86_SP]; 29 29 30 - map = maps__find(thread->mg, (u64)sp); 30 + map = maps__find(thread->maps, (u64)sp); 31 31 if (!map) { 32 32 pr_debug("failed to get stack map\n"); 33 33 free(buf);
+1 -1
tools/perf/builtin-report.c
··· 790 790 791 791 fprintf(fp, "%s\n", thread__comm_str(thread)); 792 792 793 - maps__fprintf_task(thread->mg, comm_indent, fp); 793 + maps__fprintf_task(thread->maps, comm_indent, fp); 794 794 795 795 if (!list_empty(&task->children)) { 796 796 list_for_each_entry(child, &task->children, list)
+1 -1
tools/perf/tests/code-reading.c
··· 276 276 len = al.map->end - addr; 277 277 278 278 /* Read the object code using perf */ 279 - ret_len = dso__data_read_offset(al.map->dso, thread->mg->machine, 279 + ret_len = dso__data_read_offset(al.map->dso, thread->maps->machine, 280 280 al.addr, buf1, len); 281 281 if (ret_len != len) { 282 282 pr_debug("dso__data_read_offset failed\n");
+6 -6
tools/perf/tests/thread-mg-share.c
··· 42 42 TEST_ASSERT_VAL("failed to create threads", 43 43 leader && t1 && t2 && t3 && other); 44 44 45 - mg = leader->mg; 45 + mg = leader->maps; 46 46 TEST_ASSERT_EQUAL("wrong refcnt", refcount_read(&mg->refcnt), 4); 47 47 48 48 /* test the map groups pointer is shared */ 49 - TEST_ASSERT_VAL("map groups don't match", mg == t1->mg); 50 - TEST_ASSERT_VAL("map groups don't match", mg == t2->mg); 51 - TEST_ASSERT_VAL("map groups don't match", mg == t3->mg); 49 + TEST_ASSERT_VAL("map groups don't match", mg == t1->maps); 50 + TEST_ASSERT_VAL("map groups don't match", mg == t2->maps); 51 + TEST_ASSERT_VAL("map groups don't match", mg == t3->maps); 52 52 53 53 /* 54 54 * Verify the other leader was created by previous call. ··· 70 70 machine__remove_thread(machine, other); 71 71 machine__remove_thread(machine, other_leader); 72 72 73 - other_mg = other->mg; 73 + other_mg = other->maps; 74 74 TEST_ASSERT_EQUAL("wrong refcnt", refcount_read(&other_mg->refcnt), 2); 75 75 76 - TEST_ASSERT_VAL("map groups don't match", other_mg == other_leader->mg); 76 + TEST_ASSERT_VAL("map groups don't match", other_mg == other_leader->maps); 77 77 78 78 /* release thread group */ 79 79 thread__put(leader);
+1 -1
tools/perf/ui/stdio/hist.c
··· 885 885 } 886 886 887 887 if (h->ms.map == NULL && verbose > 1) { 888 - maps__fprintf(h->thread->mg, fp); 888 + maps__fprintf(h->thread->maps, fp); 889 889 fprintf(fp, "%.10s end\n", graph_dotted_line); 890 890 } 891 891 }
+1 -1
tools/perf/util/db-export.c
··· 251 251 */ 252 252 al.sym = node->ms.sym; 253 253 al.map = node->ms.map; 254 - al.mg = thread->mg; 254 + al.mg = thread->maps; 255 255 al.addr = node->ip; 256 256 257 257 if (al.map && !al.sym)
+2 -2
tools/perf/util/event.c
··· 457 457 struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr, 458 458 struct addr_location *al) 459 459 { 460 - struct maps *mg = thread->mg; 460 + struct maps *mg = thread->maps; 461 461 struct machine *machine = mg->machine; 462 462 bool load_map = false; 463 463 ··· 523 523 struct addr_location *al) 524 524 { 525 525 struct map *map = thread__find_map(thread, cpumode, addr, al); 526 - struct machine *machine = thread->mg->machine; 526 + struct machine *machine = thread->maps->machine; 527 527 u8 addr_cpumode = machine__addr_cpumode(machine, cpumode, addr); 528 528 529 529 if (map || addr_cpumode == cpumode)
+8 -8
tools/perf/util/machine.c
··· 412 412 if (!leader) 413 413 goto out_err; 414 414 415 - if (!leader->mg) 416 - leader->mg = maps__new(machine); 415 + if (!leader->maps) 416 + leader->maps = maps__new(machine); 417 417 418 - if (!leader->mg) 418 + if (!leader->maps) 419 419 goto out_err; 420 420 421 - if (th->mg == leader->mg) 421 + if (th->maps == leader->maps) 422 422 return; 423 423 424 - if (th->mg) { 424 + if (th->maps) { 425 425 /* 426 426 * Maps are created from MMAP events which provide the pid and 427 427 * tid. Consequently there never should be any maps on a thread 428 428 * with an unknown pid. Just print an error if there are. 429 429 */ 430 - if (!maps__empty(th->mg)) 430 + if (!maps__empty(th->maps)) 431 431 pr_err("Discarding thread maps for %d:%d\n", 432 432 th->pid_, th->tid); 433 - maps__put(th->mg); 433 + maps__put(th->maps); 434 434 } 435 435 436 - th->mg = maps__get(leader->mg); 436 + th->maps = maps__get(leader->maps); 437 437 out_put: 438 438 thread__put(leader); 439 439 return;
+1 -1
tools/perf/util/map.c
··· 819 819 */ 820 820 int maps__clone(struct thread *thread, struct maps *parent) 821 821 { 822 - struct maps *mg = thread->mg; 822 + struct maps *mg = thread->maps; 823 823 int err = -ENOMEM; 824 824 struct map *map; 825 825
+2 -2
tools/perf/util/thread-stack.c
··· 134 134 if (err) 135 135 return err; 136 136 137 - if (thread->mg && thread->mg->machine) { 138 - struct machine *machine = thread->mg->machine; 137 + if (thread->maps && thread->maps->machine) { 138 + struct machine *machine = thread->maps->machine; 139 139 const char *arch = perf_env__arch(machine->env); 140 140 141 141 ts->kernel_start = machine__kernel_start(machine);
+15 -15
tools/perf/util/thread.c
··· 24 24 pid_t pid = thread->pid_; 25 25 26 26 if (pid == thread->tid || pid == -1) { 27 - thread->mg = maps__new(machine); 27 + thread->maps = maps__new(machine); 28 28 } else { 29 29 struct thread *leader = __machine__findnew_thread(machine, pid, pid); 30 30 if (leader) { 31 - thread->mg = maps__get(leader->mg); 31 + thread->maps = maps__get(leader->maps); 32 32 thread__put(leader); 33 33 } 34 34 } 35 35 36 - return thread->mg ? 0 : -1; 36 + return thread->maps ? 0 : -1; 37 37 } 38 38 39 39 struct thread *thread__new(pid_t pid, pid_t tid) ··· 86 86 87 87 thread_stack__free(thread); 88 88 89 - if (thread->mg) { 90 - maps__put(thread->mg); 91 - thread->mg = NULL; 89 + if (thread->maps) { 90 + maps__put(thread->maps); 91 + thread->maps = NULL; 92 92 } 93 93 down_write(&thread->namespaces_lock); 94 94 list_for_each_entry_safe(namespaces, tmp_namespaces, ··· 251 251 list_add(&new->list, &thread->comm_list); 252 252 253 253 if (exec) 254 - unwind__flush_access(thread->mg); 254 + unwind__flush_access(thread->maps); 255 255 } 256 256 257 257 thread->comm_set = true; ··· 324 324 size_t thread__fprintf(struct thread *thread, FILE *fp) 325 325 { 326 326 return fprintf(fp, "Thread %d %s\n", thread->tid, thread__comm_str(thread)) + 327 - maps__fprintf(thread->mg, fp); 327 + maps__fprintf(thread->maps, fp); 328 328 } 329 329 330 330 int thread__insert_map(struct thread *thread, struct map *map) 331 331 { 332 332 int ret; 333 333 334 - ret = unwind__prepare_access(thread->mg, map, NULL); 334 + ret = unwind__prepare_access(thread->maps, map, NULL); 335 335 if (ret) 336 336 return ret; 337 337 338 - maps__fixup_overlappings(thread->mg, map, stderr); 339 - maps__insert(thread->mg, map); 338 + maps__fixup_overlappings(thread->maps, map, stderr); 339 + maps__insert(thread->maps, map); 340 340 341 341 return 0; 342 342 } ··· 345 345 { 346 346 bool initialized = false; 347 347 int err = 0; 348 - struct maps *maps = thread->mg; 348 + struct maps *maps = thread->maps; 349 349 struct map *map; 350 350 351 351 down_read(&maps->lock); 352 352 353 353 maps__for_each_entry(maps, map) { 354 - err = unwind__prepare_access(thread->mg, map, &initialized); 354 + err = unwind__prepare_access(thread->maps, map, &initialized); 355 355 if (err || initialized) 356 356 break; 357 357 } ··· 377 377 if (thread->pid_ == parent->pid_) 378 378 return thread__prepare_access(thread); 379 379 380 - if (thread->mg == parent->mg) { 380 + if (thread->maps == parent->maps) { 381 381 pr_debug("broken map groups on thread %d/%d parent %d/%d\n", 382 382 thread->pid_, thread->tid, parent->pid_, parent->tid); 383 383 return 0; 384 384 } 385 385 /* But this one is new process, copy maps. */ 386 - return do_maps_clone ? maps__clone(thread, parent->mg) : 0; 386 + return do_maps_clone ? maps__clone(thread, parent->maps) : 0; 387 387 } 388 388 389 389 int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp, bool do_maps_clone)
+1 -1
tools/perf/util/thread.h
··· 25 25 struct rb_node rb_node; 26 26 struct list_head node; 27 27 }; 28 - struct maps *mg; 28 + struct maps *maps; 29 29 pid_t pid_; /* Not all tools update this */ 30 30 pid_t tid; 31 31 pid_t ppid;
+1 -1
tools/perf/util/unwind-libdw.c
··· 200 200 struct unwind_info *ui, ui_buf = { 201 201 .sample = data, 202 202 .thread = thread, 203 - .machine = thread->mg->machine, 203 + .machine = thread->maps->machine, 204 204 .cb = cb, 205 205 .arg = arg, 206 206 .max_stack = max_stack,
+2 -2
tools/perf/util/unwind-libunwind-local.c
··· 660 660 */ 661 661 if (max_stack - 1 > 0) { 662 662 WARN_ONCE(!ui->thread, "WARNING: ui->thread is NULL"); 663 - addr_space = ui->thread->mg->addr_space; 663 + addr_space = ui->thread->maps->addr_space; 664 664 665 665 if (addr_space == NULL) 666 666 return -1; ··· 709 709 struct unwind_info ui = { 710 710 .sample = data, 711 711 .thread = thread, 712 - .machine = thread->mg->machine, 712 + .machine = thread->maps->machine, 713 713 }; 714 714 715 715 if (!data->user_regs.regs)
+2 -2
tools/perf/util/unwind-libunwind.c
··· 82 82 struct thread *thread, 83 83 struct perf_sample *data, int max_stack) 84 84 { 85 - if (thread->mg->unwind_libunwind_ops) 86 - return thread->mg->unwind_libunwind_ops->get_entries(cb, arg, thread, data, max_stack); 85 + if (thread->maps->unwind_libunwind_ops) 86 + return thread->maps->unwind_libunwind_ops->get_entries(cb, arg, thread, data, max_stack); 87 87 return 0; 88 88 }
+1 -1
tools/perf/util/vdso.c
··· 144 144 enum dso_type dso_type = DSO__TYPE_UNKNOWN; 145 145 struct map *map; 146 146 147 - maps__for_each_entry(thread->mg, map) { 147 + maps__for_each_entry(thread->maps, map) { 148 148 struct dso *dso = map->dso; 149 149 if (!dso || dso->long_name[0] != '/') 150 150 continue;