1. 29 4月, 2015 16 次提交
  2. 14 4月, 2015 4 次提交
  3. 13 4月, 2015 2 次提交
    • N
      perf kmem: Analyze page allocator events also · 0d68bc92
      Namhyung Kim 提交于
      The perf kmem command records and analyze kernel memory allocation only
      for SLAB objects.  This patch implement a simple page allocator analyzer
      using kmem:mm_page_alloc and kmem:mm_page_free events.
      
      It adds two new options of --slab and --page.  The --slab option is for
      analyzing SLAB allocator and that's what perf kmem currently does.
      
      The new --page option enables page allocator events and analyze kernel
      memory usage in page unit.  Currently, 'stat --alloc' subcommand is
      implemented only.
      
      If none of these --slab nor --page is specified, --slab is implied.
      
      First run 'perf kmem record' to generate a suitable perf.data file:
      
        # perf kmem record --page sleep 5
      
      Then run 'perf kmem stat' to postprocess the perf.data file:
      
        # perf kmem stat --page --alloc --line 10
      
        -------------------------------------------------------------------------------
         PFN              | Total alloc (KB) | Hits     | Order | Mig.type | GFP flags
        -------------------------------------------------------------------------------
                  4045014 |               16 |        1 |     2 |  RECLAIM |  00285250
                  4143980 |               16 |        1 |     2 |  RECLAIM |  00285250
                  3938658 |               16 |        1 |     2 |  RECLAIM |  00285250
                  4045400 |               16 |        1 |     2 |  RECLAIM |  00285250
                  3568708 |               16 |        1 |     2 |  RECLAIM |  00285250
                  3729824 |               16 |        1 |     2 |  RECLAIM |  00285250
                  3657210 |               16 |        1 |     2 |  RECLAIM |  00285250
                  4120750 |               16 |        1 |     2 |  RECLAIM |  00285250
                  3678850 |               16 |        1 |     2 |  RECLAIM |  00285250
                  3693874 |               16 |        1 |     2 |  RECLAIM |  00285250
         ...              | ...              | ...      | ...   | ...      | ...
        -------------------------------------------------------------------------------
      
        SUMMARY (page allocator)
        ========================
        Total allocation requests     :           44,260   [          177,256 KB ]
        Total free requests           :              117   [              468 KB ]
      
        Total alloc+freed requests    :               49   [              196 KB ]
        Total alloc-only requests     :           44,211   [          177,060 KB ]
        Total free-only requests      :               68   [              272 KB ]
      
        Total allocation failures     :                0   [                0 KB ]
      
        Order     Unmovable   Reclaimable       Movable      Reserved  CMA/Isolated
        -----  ------------  ------------  ------------  ------------  ------------
            0            32             .        44,210             .             .
            1             .             .             .             .             .
            2             .            18             .             .             .
            3             .             .             .             .             .
            4             .             .             .             .             .
            5             .             .             .             .             .
            6             .             .             .             .             .
            7             .             .             .             .             .
            8             .             .             .             .             .
            9             .             .             .             .             .
           10             .             .             .             .             .
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joonsoo Kim <js1304@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/1428298576-9785-4-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0d68bc92
    • N
      tracing, mm: Record pfn instead of pointer to struct page · 9fdd8a87
      Namhyung Kim 提交于
      The struct page is opaque for userspace tools, so it'd be better to save
      pfn in order to identify page frames.
      
      The textual output of $debugfs/tracing/trace file remains unchanged and
      only raw (binary) data format is changed - but thanks to libtraceevent,
      userspace tools which deal with the raw data (like perf and trace-cmd)
      can parse the format easily.  So impact on the userspace will also be
      minimal.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Based-on-patch-by: NJoonsoo Kim <js1304@gmail.com>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/1428298576-9785-3-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9fdd8a87
  4. 12 4月, 2015 1 次提交
  5. 11 4月, 2015 1 次提交
    • I
      Merge tag 'perf-core-for-mingo' of... · 5dafd7cb
      Ingo Molnar 提交于
      Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      New user visible features:
      
        - Support multiple probes on different binaries on the same command line (Masami Hiramatsu)
      
      User visible changes:
      
        - Fix synthesizing fork_event.ppid for non-main thread (David Ahern)
      
        - Fix cross-endian analysis (David Ahern)
      
        - Fix segfault in 'perf buildid-list' when show DSOs with hits (He Kuang)
      
      Infrastructure changes:
      
        - Fix type for references to data_head/tail (David Ahern)
      
        - Fix error path to do closedir() when synthesizing threads (Arnaldo Carvalho de Melo)
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      5dafd7cb
  6. 10 4月, 2015 7 次提交
  7. 08 4月, 2015 9 次提交
    • I
      Merge tag 'perf-core-for-mingo' of... · 51ab7155
      Ingo Molnar 提交于
      Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      User visible changes:
      
        - Teach 'perf record' about perf_event_attr.clockid (Peter Zijlstra)
      
        - Improve 'perf sched replay' on high CPU core count machines (Yunlong Song)
      
        - Consider PERF_RECORD_ events with cpumode == 0 in 'perf top', removing one
          cause of long term memory usage buildup, i.e. not processing PERF_RECORD_EXIT
          events (Arnaldo Carvalho de Melo)
      
        - Add 'I' event modifier for perf_event_attr.exclude_idle bit (Jiri Olsa)
      
        - Respect -i option 'in perf kmem' (Jiri Olsa)
      
      Infrastructure changes:
      
        - Honor operator priority in libtraceevent (Namhyung Kim)
      
        - Merge all perf_event_attr print functions (Peter Zijlstra)
      
        - Check kmaps access to make code more robust (Wang Nan)
      
        - Fix inverted logic in perf_mmap__empty() (He Kuang)
      
        - Fix ARM 32 'perf probe' building error (Wang Nan)
      
        - Fix perf_event_attr tests (Jiri Olsa)
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      51ab7155
    • J
      perf tools: Add 'I' event modifier for exclude_idle bit · a1e12da4
      Jiri Olsa 提交于
      Adding 'I' event modifier to have complete set of modifiers for
      perf_event_attr:exclude_* bits.
      
      Any event specified with 'I' modifier will have the
      perf_event_attr:exclude_idle bit set.
      
        $ perf record -e cycles:I -vv ls 2>&1 | grep exclude_idle
        exclude_hv          0    exclude_idle        1
      
      Adding automated tests.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: William Cohen <wcohen@redhat.com>
      Link: http://lkml.kernel.org/r/1428441919-23099-2-git-send-email-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a1e12da4
    • W
      perf report: Don't call map__kmap if map is NULL. · f6fcc143
      Wang Nan 提交于
      report__warn_kptr_restrict() calls map__kmap(kernel_map) before checking
      kernel_map againest NULL.
      
      Which is dangerous, since map__kmap() will return a invalid and not NULL
      address.
      
      It will trigger a warning message in map__kmap() after the patch "perf:
      kmaps: enforce usage of kmaps to protect futher bugs." was applied.
      
      This patch fixes it by adding the missing checking.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1428490772-135393-1-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f6fcc143
    • J
      perf tests: Fix attr tests · 54a50f93
      Jiri Olsa 提交于
      Following commit:
        1a594131 perf: Add wakeup watermark control to the AUX area
      
      enlarged perf_event_attr, but did not updated attr tests.
      Reported-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Kaixu Xia <kaixu.xia@linaro.org>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <rric@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Markus T Metzger <markus.t.metzger@intel.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Link: http://lkml.kernel.org/n/20150407171715.GA22603@krava.redhat.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      54a50f93
    • W
      perf probe: Fix ARM 32 building error · f6c15621
      Wang Nan 提交于
      Commit 9b118aca ("perf probe: Fix to
      handle aliased symbols in glibc") uses an absolute format '%lx' to
      print u64 argument, which causes compiling error on ARM 32.
      
      This patch replaces it with PRIx64.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1428459274-138470-1-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f6c15621
    • P
      perf tools: Merge all perf_event_attr print functions · 2c5e8c52
      Peter Zijlstra 提交于
      Currently there's 3 (that I found) different and incomplete
      implementations of printing perf_event_attr.
      
      This is quite silly. Merge the lot.
      
      While this patch does not retain the exact form all printing that I
      found is debug output and thus it should not be critical.
      
      Also, I cannot find a single print_event_desc() caller.
      
      Pre:
      
       $ perf record -vv -e cycles -- sleep 1
       ------------------------------------------------------------
       perf_event_attr:
        type                0
        size                104
        config              0
        sample_period       4000
        sample_freq         4000
        sample_type         0x107
        read_format         0
        disabled            1    inherit             1
        pinned              0    exclusive           0
        exclude_user        0    exclude_kernel      0
        exclude_hv          0    exclude_idle        0
        mmap                1    comm                1
        mmap2               1    comm_exec           1
        freq                1    inherit_stat        0
        enable_on_exec      1    task                1
        watermark           0    precise_ip          0
        mmap_data           0    sample_id_all       1
        exclude_host        0    exclude_guest       1
        excl.callchain_kern 0    excl.callchain_user 0
        wakeup_events       0
        wakeup_watermark    0
        bp_type             0
        bp_addr             0
        config1             0
        bp_len              0
        config2             0
        branch_sample_type  0
        sample_regs_user    0
        sample_stack_user   0
        sample_regs_intr    0
       ------------------------------------------------------------
      
       $ perf evlist  -vv
       cycles: sample_freq=4000, size: 104, sample_type: IP|TID|TIME|PERIOD,
       disabled: 1, inherit: 1, mmap: 1, mmap2: 1, comm: 1, comm_exec: 1,
       freq: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1
      
       Post:
      
       $ ./perf record -vv -e cycles -- sleep 1
       ------------------------------------------------------------
       perf_event_attr:
        size                             112
        { sample_period, sample_freq }   4000
        sample_type                      IP|TID|TIME|PERIOD
        disabled                         1
        inherit                          1
        mmap                             1
        comm                             1
        freq                             1
        enable_on_exec                   1
        task                             1
        sample_id_all                    1
        exclude_guest                    1
        mmap2                            1
        comm_exec                        1
      ------------------------------------------------------------
      
       $ ./perf evlist  -vv
       cycles: size: 112, { sample_period, sample_freq }: 4000, sample_type:
       IP|TID|TIME|PERIOD, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq:
       1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1,
       mmap2: 1, comm_exec: 1
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20150407091150.644238729@infradead.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2c5e8c52
    • P
      perf record: Add clockid parameter · 814c8c38
      Peter Zijlstra 提交于
      Teach perf-record about the new perf_event_attr::{use_clockid, clockid}
      fields. Add a simple parameter to set the clock (if any) to be used for
      the events to be recorded into the data file.
      
      Since we store the entire perf_event_attr in the EVENT_DESC section we
      also already store the used clockid in the data file.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Yunlong Song <yunlong.song@huawei.com>
      Link: http://lkml.kernel.org/r/20150407154851.GR23123@twins.programming.kicks-ass.net
      [ Conditionally define CLOCK_BOOTTIME, at least rhel6 doesn't have it - dsahern
        Ditto for CLOCK_MONOTONIC_RAW, sles11sp2 doesn't have it - yunlong.song ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      814c8c38
    • Y
      perf sched replay: Use replay_repeat to calculate the runavg of cpu usage... · ff5f3bbd
      Yunlong Song 提交于
      perf sched replay: Use replay_repeat to calculate the runavg of cpu usage instead of the default value 10
      
      Since sched->replay_repeat is set to 10 as default, the sched->run_avg,
      sched->runavg_cpu_usage, and sched->runavg_parent_cpu_usage all use
      10 to calculate their value.
      
      However, the replay_repeat can be changed to other value by using -r
      option, so the calculation above should use replay_repeat to achieve
      more accurate results instead of the default value 10.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427809596-29559-10-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ff5f3bbd
    • Y
      perf sched replay: Support using -f to override perf.data file ownership · f0dd330f
      Yunlong Song 提交于
      Enable to use perf.data when it is not owned by current user or root.
      
      Example:
      
       $ ls -al perf.data
       -rw------- 1 Yunlong.Song Yunlong.Song 5321918 Mar 25 15:14 perf.data
       $ sudo id
       uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
      
      Before this patch:
      
       $ sudo perf sched replay -f
       run measurement overhead: 98 nsecs
       sleep measurement overhead: 52909 nsecs
       the run test took 1000015 nsecs
       the sleep test took 1054253 nsecs
       File perf.data not owned by current user or root (use -f to override)
      
      As shown above, the -f option does not work at all.
      
      After this patch:
      
       $ sudo perf sched replay -f
       run measurement overhead: 221 nsecs
       sleep measurement overhead: 40514 nsecs
       the run test took 1000003 nsecs
       the sleep test took 1056098 nsecs
       nr_run_events:        10
       nr_sleep_events:      1562
       nr_wakeup_events:     5
       task      0 (                  :1:         1), nr_events: 1
       task      1 (                  :2:         2), nr_events: 1
       task      2 (                  :3:         3), nr_events: 1
       ...
       ...
       task   1549 (             :163132:    163132), nr_events: 1
       task   1550 (             :163540:    163540), nr_events: 1
       task   1551 (           <unknown>:         0), nr_events: 10
       ------------------------------------------------------------
       #1  : 50.198, ravg: 50.20, cpu: 2335.18 / 2335.18
       #2  : 219.099, ravg: 67.09, cpu: 2835.11 / 2385.17
       #3  : 238.626, ravg: 84.24, cpu: 3278.26 / 2474.48
       #4  : 200.364, ravg: 95.85, cpu: 2977.41 / 2524.77
       #5  : 176.882, ravg: 103.96, cpu: 2801.35 / 2552.43
       #6  : 191.093, ravg: 112.67, cpu: 2813.70 / 2578.56
       #7  : 189.448, ravg: 120.35, cpu: 2809.21 / 2601.62
       #8  : 200.637, ravg: 128.38, cpu: 2849.91 / 2626.45
       #9  : 248.338, ravg: 140.37, cpu: 4380.61 / 2801.87
       #10 : 511.139, ravg: 177.45, cpu: 3077.73 / 2829.45
      
      As shown above, the -f option really works now.
      
      Besides for replay, -f option can also work for latency and map.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427809596-29559-9-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f0dd330f