• Masami Hiramatsu's avatar
    perf tools: Fix maps__fixup_overlappings to put used maps · d91130e9
    Masami Hiramatsu authored
    Since the __map_groups__insert got the given map, we don't need to keep
    it. So put the maps.
    
    Refcnt debugger shows that map_groups__fixup_overlappings() got a map
    twice but the group released it just once. This pattern usually
    indicates the leak happens in caller site.
    
      ----
      ==== [0] ====
      Unreclaimed map@0x39d3ae0
      Refcount +1 => 1 at
        ./perf(map_groups__fixup_overlappings+0x335) [0x4c1865]
        ./perf(thread__insert_map+0x30) [0x4c8e00]
        ./perf(machine__process_mmap2_event+0x106) [0x4bd876]
        ./perf() [0x4c378e]
        ./perf() [0x4c4393]
        ./perf(perf_session__process_events+0x38a) [0x4c654a]
        ./perf(cmd_record+0xe24) [0x42fc94]
        ./perf() [0x47b745]
        ./perf(main+0x617) [0x422547]
        /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f2eca2deaf5]
        ./perf() [0x4226bd]
      Refcount +1 => 2 at
        ./perf(map_groups__fixup_overlappings+0x3c5) [0x4c18f5]
        ./perf(thread__insert_map+0x30) [0x4c8e00]
        ./perf(machine__process_mmap2_event+0x106) [0x4bd876]
        ./perf() [0x4c378e]
        ./perf() [0x4c4393]
        ./perf(perf_session__process_events+0x38a) [0x4c654a]
        ./perf(cmd_record+0xe24) [0x42fc94]
        ./perf() [0x47b745]
        ./perf(main+0x617) [0x422547]
        /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f2eca2deaf5]
        ./perf() [0x4226bd]
      Refcount -1 => 1 at
        ./perf(map_groups__exit+0x92) [0x4c0962]
        ./perf(map_groups__put+0x60) [0x4c0bc0]
        ./perf(thread__put+0x90) [0x4c8a40]
        ./perf(machine__delete_threads+0x7e) [0x4bad9e]
        ./perf(perf_session__delete+0x4f) [0x4c499f]
        ./perf(cmd_record+0xb6d) [0x42f9dd]
        ./perf() [0x47b745]
        ./perf(main+0x617) [0x422547]
        /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f2eca2deaf5]
        ./perf() [0x4226bd]
      ----
    Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Link: http://lkml.kernel.org/r/20151209021131.10245.41485.stgit@localhost.localdomainSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    d91130e9
map.c 18.8 KB