1. 09 5月, 2015 7 次提交
    • A
      perf tools: Move x86 barrier.h stuff to tools/arch/x86/include/asm/barrier.h · 361c564e
      Arnaldo Carvalho de Melo 提交于
      We will need it for atomic.h, so move it from the ad-hoc tools/perf/
      place to a tools/ subset of the kernel arch/ hierarchy.
      
      Other aches will follow, each in a cset.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-vy6bqmsvm6puibpay2cy4wid@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      361c564e
    • M
      perf probe: Support $params special probe argument · f8bffbf1
      Masami Hiramatsu 提交于
      $params is similar to $vars but matches only function parameters not
      local variables.
      
      Thus, this is useful for tracing function parameter changing or tracing
      function call with parameters.
      
      Testing it:
      
       # perf probe tcp_sendmsg '$params'
       Added new event:
        probe:tcp_sendmsg    (on tcp_sendmsg with $params)
      
       You can now use it in all perf tools, such as:
      
      	perf record -e probe:tcp_sendmsg -aR sleep 1
      
       # perf probe -l
        probe:tcp_sendmsg    (on tcp_sendmsg@acme/git/linux/net/ipv4/tcp.c with iocb sk msg size)
       # perf record -a -e probe:*
       press some random letters to generate TCP (sshd) traffic...
      
       ^C[ perf record: Woken up 1 times to write data ]
       [ perf record: Captured and wrote 0.223 MB perf.data (6 samples) ]
      
       # perf script
         sshd 6385 [2] 3.907529: probe:tcp_sendmsg: iocb=0xffff8800ac4cfe70 sk=0xffff88042196c140 msg=0xffff8800ac4cfda8 size=0x24
         sshd 6385 [2] 4.138973: probe:tcp_sendmsg: iocb=0xffff8800ac4cfe70 sk=0xffff88042196c140 msg=0xffff8800ac4cfda8 size=0x24
         sshd 6385 [2] 4.378966: probe:tcp_sendmsg: iocb=0xffff8800ac4cfe70 sk=0xffff88042196c140 msg=0xffff8800ac4cfda8 size=0x24
         sshd 6385 [2] 4.603681: probe:tcp_sendmsg: iocb=0xffff8800ac4cfe70 sk=0xffff88042196c140 msg=0xffff8800ac4cfda8 size=0x24
         sshd 6385 [2] 4.818455: probe:tcp_sendmsg: iocb=0xffff8800ac4cfe70 sk=0xffff88042196c140 msg=0xffff8800ac4cfda8 size=0x24
         sshd 6385 [2] 5.043603: probe:tcp_sendmsg: iocb=0xffff8800ac4cfe70 sk=0xffff88042196c140 msg=0xffff8800ac4cfda8 size=0x24
       # cat /sys/kernel/debug/tracing/events/probe/tcp_sendmsg/format
       name: tcp_sendmsg
       ID: 1927
       format:
         field:unsigned short common_type;	offset:0;	size:2;	signed:0;
         field:unsigned char common_flags;	offset:2;	size:1;	signed:0;
         field:unsigned char common_preempt_count;	offset:3;	size:1;	signed:0;
         field:int common_pid;	offset:4;	size:4;	signed:1;
      
         field:unsigned long __probe_ip;	offset:8;	size:8;	signed:0;
         field:u64 iocb;	offset:16;	size:8;	signed:0;
         field:u64 sk;	offset:24;	size:8;	signed:0;
         field:u64 msg;	offset:32;	size:8;	signed:0;
         field:u64 size;	offset:40;	size:8;	signed:0;
      
       print fmt: "(%lx) iocb=0x%Lx sk=0x%Lx msg=0x%Lx size=0x%Lx", REC->__probe_ip, REC->iocb, REC->sk, REC->msg, REC->size
       #
      
       Do some system wide tracing of this probe + write syscalls:
      
       # perf trace -e write --ev probe:* --filter-pids 6385
        462.612 (0.010 ms): bash/19153 write(fd: 1</dev/pts/1>, buf: 0x7f7556c78000, count: 29               ) = 29
        462.701 (0.027 ms): sshd/19152 write(fd: 3<socket:[63117]>, buf: 0x7f78dd12e160, count: 68           ) ...
        462.701 (        ): probe:tcp_sendmsg:(ffffffff8163db30) iocb=0xffff8803ebec7e70 sk=0xffff88042196ab80 msg=0xffff8803ebec7da8 size=0x44)
        462.710 (0.035 ms): sshd/19152  ... [continued]: write()) = 68
        462.787 (0.009 ms): bash/19153 write(fd: 2</dev/pts/1>, buf: 0x7f7556c77000, count: 22               ) = 22
        462.865 (0.002 ms): sshd/19152 write(fd: 3<socket:[63117]>, buf: 0x7f78dd12e160, count: 68           ) ...
        462.865 (        ): probe:tcp_sendmsg:(ffffffff8163db30) iocb=0xffff8803ebec7e70 sk=0xffff88042196ab80 msg=0xffff8803ebec7da8 size=0x44)
        462.873 (0.010 ms): sshd/19152  ... [continued]: write()) = 68
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20150506124653.4961.59806.stgit@localhost.localdomain
      [ Add some examples to the changelog message showing how to use it ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f8bffbf1
    • M
      perf probe: Skip kernel symbols which is out of .text · 5a51fcd1
      Masami Hiramatsu 提交于
      Skip the kernel symbols which is out of .text, e.g. the functions
      in .inittext. Those are found in debuginfo/kallsyms, but already
      freed from memory.
      
      e.g.
        ----
        # perf probe vfs_caches_init
        vfs_caches_init+0 is out of .text, skip it.
        Probe point 'vfs_caches_init' not found.
          Error: Failed to add events.
        ----
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20150506124649.4961.56249.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5a51fcd1
    • M
      perf probe: Make --line checks validate C-style function name · 573709fd
      Masami Hiramatsu 提交于
      Fix --line to check valid C-style function name and returns
      a semantic error if it is not.
      
      For example, previously, --line doesn't support lazy pattern
      but it doesn't recognized as a semantic error.
      
        ----
        # perf probe -L 'func;return*:0-10'
        Specified source line is not found.
          Error: Failed to show lines.
        ----
      
      With this patch, it is correctly handled as a semantic error.
        ----
        # perf probe -L 'func;return*:0-10'
        Semantic error :'func;return*' is not a valid function name.
        ...
        ----
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20150506124647.4961.99473.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      573709fd
    • M
      perf probe: Fix to return 0 when positive value returned · 9bc9f3b6
      Masami Hiramatsu 提交于
      Fix to return 0 when positive value returned from probe command.
      
      At least --vars can returns a positive value if it found a point.
        ----
        # perf probe --vars vfs_read && echo succeeded! || echo failed!
        Available variables at vfs_read
                @<vfs_read+0>
                        char*   buf
                        loff_t* pos
                        size_t  count
                        struct file*    file
        failed!
        ----
      
      This fixes above problem.
        ----
        # perf probe --vars vfs_read && echo succeeded! || echo failed!
        Available variables at vfs_read
                @<vfs_read+0>
                        char*   buf
                        loff_t* pos
                        size_t  count
                        struct file*    file
        succeeded!
        ----
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20150506124645.4961.56973.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9bc9f3b6
    • M
      perf probe: Fix a typo for the flags of open · b8dc3984
      Masami Hiramatsu 提交于
      Fix to pass O_APPEND by using bit-or with other flags, instead of
      passing it as mode.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: hemant@linux.vnet.ibm.com
      Link: http://lkml.kernel.org/r/20150506124642.4961.97878.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b8dc3984
    • M
      perf probe: Fix to close probe_events file in error · ae2cb1ac
      Masami Hiramatsu 提交于
      Fix perf-probe to close probe_events file if it failed to get existing
      probe's name. This also fix the return error code to -ENOMEM.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: hemant@linux.vnet.ibm.com
      Link: http://lkml.kernel.org/r/20150506124640.4961.26062.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ae2cb1ac
  2. 08 5月, 2015 2 次提交
    • M
      perf_event: Don't allow vmalloc() backed perf on powerpc · cb307113
      Michael Ellerman 提交于
      On powerpc the perf event interrupt is not masked when interrupts are
      disabled, allowing it to function as an NMI.
      
      This causes problems if perf is using vmalloc. If we take a page fault
      on the vmalloc region the fault handler will fail the page fault because
      it detects we are coming in from an NMI (see do_hash_page()).
      
      We don't actually need or want vmalloc backed perf so just disable it on
      powerpc.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: <linuxppc-dev@ozlabs.org>
      Cc: Andrew Morton <akpm@osdl.org>
      Cc: Anton Blanchard <anton@samba.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: acme@ghostprotocols.net
      Cc: sukadev@linux.vnet.ibm.com
      Link: http://lkml.kernel.org/r/1430720799-18426-1-git-send-email-mpe@ellerman.id.auSigned-off-by: NIngo Molnar <mingo@kernel.org>
      cb307113
    • P
      perf: Fix software migrate events · ff303e66
      Peter Zijlstra 提交于
      Stephane asked about PERF_COUNT_SW_CPU_MIGRATIONS and I realized it
      was borken:
      
       > The problem is that the task isn't actually scheduled while its being
       > migrated (obviously), and if its not scheduled, the counters aren't
       > scheduled either, so there's no observing of the fact.
       >
       > A further problem with migrations is that many migrations happen from
       > softirq context, which is nested inside the 'random' task context of
       > whoemever happens to run at that time, similarly for the wakeup
       > migrations triggered from (soft)irq context. All those end up being
       > accounted in the task that's currently running, eg. your 'ls'.
      
      The below cures this by marking a task as migrated and accounting it
      on the subsequent sched_in().
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      ff303e66
  3. 06 5月, 2015 23 次提交
  4. 05 5月, 2015 7 次提交
    • A
      perf tools: Hit all build ids when AUX area tracing · cd10b289
      Adrian Hunter 提交于
      We need to include all buildids when a perf.data file contains AUX area
      tracing data because we do not decode the trace for that purpose because
      it would take too long.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1430404667-10593-4-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cd10b289
    • A
      perf tools: Add AUX area tracing index · 99fa2984
      Adrian Hunter 提交于
      Add an index of AUX area tracing events within a perf.data file.
      
      perf record uses a special user event PERF_RECORD_FINISHED_ROUND to
      enable sorting of events in chunks instead of having to sort all events
      altogether.
      
      AUX area tracing events contain data that can span back to the very
      beginning of the recording period. i.e. they do not obey the rules of
      PERF_RECORD_FINISHED_ROUND.
      
      By adding an index, AUX area tracing events can be found in advance and
      the PERF_RECORD_FINISHED_ROUND approach works as usual.
      
      The index is recorded with the auxtrace feature in the perf.data file.
      A session reads the index but does not process it.  An AUX area decoder
      can queue all the AUX area data in advance using
      auxtrace_queues__process_index() or otherwise process the index in some
      custom manner.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1430404667-10593-3-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      99fa2984
    • A
      perf report: Fix placement of itrace option in documentation · 64a7e61f
      Adrian Hunter 提交于
      Unwittingly the itrace options for perf report ended up below the
      Overhead Calculation section. Move it back with the other options.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1430404667-10593-2-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      64a7e61f
    • N
      perf kmem: Add kmem.default config option · 0c160d49
      Namhyung Kim 提交于
      Currently perf kmem command will select --slab if neither --slab nor
      --page is given for backward compatibility.  Add kmem.default config
      option to select the default value ('page' or 'slab').
      
        # cat ~/.perfconfig
        [kmem]
        	default = page
      
        # perf kmem stat
      
        SUMMARY (page allocator)
        ========================
        Total allocation requests     :            1,518   [            6,096 KB ]
        Total free requests           :            1,431   [            5,748 KB ]
      
        Total alloc+freed requests    :            1,330   [            5,344 KB ]
        Total alloc-only requests     :              188   [              752 KB ]
        Total free-only requests      :              101   [              404 KB ]
      
        Total allocation failures     :                0   [                0 KB ]
        ...
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NPekka Enberg <penberg@kernel.org>
      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: Taeung Song <treeze.taeung@gmail.com>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/1429592107-1807-6-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0c160d49
    • N
      perf kmem: Print gfp flags in human readable string · 0e111156
      Namhyung Kim 提交于
      Save libtraceevent output and print it in the header.
      
        # perf kmem stat --page --caller
        #
        # GFP flags
        # ---------
        # 00000010:       NI: GFP_NOIO
        # 000000d0:        K: GFP_KERNEL
        # 00000200:      NWR: GFP_NOWARN
        # 000084d0:    K|R|Z: GFP_KERNEL|GFP_REPEAT|GFP_ZERO
        # 000200d2:       HU: GFP_HIGHUSER
        # 000200da:      HUM: GFP_HIGHUSER_MOVABLE
        # 000280da:    HUM|Z: GFP_HIGHUSER_MOVABLE|GFP_ZERO
        # 002084d0: K|R|Z|NT: GFP_KERNEL|GFP_REPEAT|GFP_ZERO|GFP_NOTRACK
        # 0102005a:  NF|HW|M: GFP_NOFS|GFP_HARDWALL|GFP_MOVABLE
      
        ---------------------------------------------------------------------------------------------------------
         Total alloc (KB) | Hits      | Order | Mig.type | GFP flags | Callsite
        ---------------------------------------------------------------------------------------------------------
                       60 |        15 |     0 | UNMOVABL | K|R|Z|NT  | pte_alloc_one
                       40 |        10 |     0 |  MOVABLE | HUM|Z     | handle_mm_fault
                       24 |         6 |     0 |  MOVABLE | HUM       | do_wp_page
                       24 |         6 |     0 | UNMOVABL | K         | __pollwait
         ...
      Requested-by: NJoonsoo Kim <js1304@gmail.com>
      Suggested-by: NMinchan Kim <minchan@kernel.org>
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NPekka Enberg <penberg@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.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/1429592107-1807-5-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0e111156
    • N
      perf kmem: Add --live option for current allocation stat · 2a7ef02c
      Namhyung Kim 提交于
      Currently 'perf kmem stat --page' shows total (page) allocation stat by
      default, but sometimes one might want to see live (total alloc-only)
      requests/pages only.  The new --live option does this by subtracting freed
      allocation from the stat.
      
      E.g.:
      
       # perf kmem stat --page
      
       SUMMARY (page allocator)
       ========================
       Total allocation requests     :          988,858   [        4,045,368 KB ]
       Total free requests           :          886,484   [        3,624,996 KB ]
      
       Total alloc+freed requests    :          885,969   [        3,622,628 KB ]
       Total alloc-only requests     :          102,889   [          422,740 KB ]
       Total free-only requests      :              515   [            2,368 KB ]
      
       Total allocation failures     :                0   [                0 KB ]
      
       Order     Unmovable   Reclaimable       Movable      Reserved  CMA/Isolated
       -----  ------------  ------------  ------------  ------------  ------------
           0       172,173         3,083       806,686             .             .
           1           284             .             .             .             .
           2         6,124            58             .             .             .
           3           114           335             .             .             .
           4             .             .             .             .             .
           5             .             .             .             .             .
           6             .             .             .             .             .
           7             .             .             .             .             .
           8             .             .             .             .             .
           9             .             .             1             .             .
          10             .             .             .             .             .
       # perf kmem stat --page --live
      
       SUMMARY (page allocator)
       ========================
       Total allocation requests     :          988,858   [        4,045,368 KB ]
       Total free requests           :          886,484   [        3,624,996 KB ]
      
       Total alloc+freed requests    :          885,969   [        3,622,628 KB ]
       Total alloc-only requests     :          102,889   [          422,740 KB ]
       Total free-only requests      :              515   [            2,368 KB ]
      
       Total allocation failures     :                0   [                0 KB ]
      
       Order     Unmovable   Reclaimable       Movable      Reserved  CMA/Isolated
       -----  ------------  ------------  ------------  ------------  ------------
           0         2,214         3,025        97,156             .             .
           1            59             .             .             .             .
           2            19            58             .             .             .
           3            23           335             .             .             .
           4             .             .             .             .             .
           5             .             .             .             .             .
           6             .             .             .             .             .
           7             .             .             .             .             .
           8             .             .             .             .             .
           9             .             .             .             .             .
          10             .             .             .             .             .
       #
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NPekka Enberg <penberg@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/1429592107-1807-4-git-send-email-namhyung@kernel.org
      [ Added examples to the changeset log ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2a7ef02c
    • N
      perf kmem: Support sort keys on page analysis · fb4f313d
      Namhyung Kim 提交于
      Add new sort keys for page: page, order, migtype, gfp - existing
      'bytes', 'hit' and 'callsite' sort keys also work for page.  Note that
      -s/--sort option should be preceded by either of --slab or --page option
      to determine where the sort keys applies.
      
      Now it properly groups and sorts allocation stats - so same
      page/caller with different order/migtype/gfp will be printed on a
      different line.
      
       # perf kmem stat --page --caller -l 10 -s order,hit
      
       -----------------------------------------------------------------------------
       Total alloc (KB) | Hits   | Order | Mig.type | GFP flags | Callsite
       -----------------------------------------------------------------------------
                     64 |      4 |     2 |  RECLAIM |  00285250 | new_slab
                 50,144 | 12,536 |     0 |  MOVABLE |  0102005a | __page_cache_alloc
                     52 |     13 |     0 | UNMOVABL |  002084d0 | pte_alloc_one
                     40 |     10 |     0 |  MOVABLE |  000280da | handle_mm_fault
                     28 |      7 |     0 | UNMOVABL |  000000d0 | __pollwait
                     20 |      5 |     0 |  MOVABLE |  000200da | do_wp_page
                     20 |      5 |     0 |  MOVABLE |  000200da | do_cow_fault
                     16 |      4 |     0 | UNMOVABL |  00000200 | __tlb_remove_page
                     16 |      4 |     0 | UNMOVABL |  000084d0 | __pmd_alloc
                      8 |      2 |     0 | UNMOVABL |  000084d0 | __pud_alloc
       ...              | ...    | ...   | ...      | ...       | ...
       -----------------------------------------------------------------------------
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NPekka Enberg <penberg@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/1429592107-1807-3-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fb4f313d
  5. 04 5月, 2015 1 次提交
    • N
      perf kmem: Implement stat --page --caller · c9758cc4
      Namhyung Kim 提交于
      It is 'perf kmem' support caller statistics for page.  Unlike slab case,
      the tracepoints in page allocator don't provide callsite info.  So it
      records with callchain and extracts callsite info.
      
      Note that the callchain contains several memory allocation functions
      which has no meaning for users.  So skip those functions to get proper
      callsites.  I used following regex pattern to skip the allocator
      functions:
      
        ^_?_?(alloc|get_free|get_zeroed)_pages?
      
      This gave me a following list of functions:
      
        # perf kmem record --page sleep 3
        # perf kmem stat --page -v
        ...
        alloc func: __get_free_pages
        alloc func: get_zeroed_page
        alloc func: alloc_pages_exact
        alloc func: __alloc_pages_direct_compact
        alloc func: __alloc_pages_nodemask
        alloc func: alloc_page_interleave
        alloc func: alloc_pages_current
        alloc func: alloc_pages_vma
        alloc func: alloc_page_buffers
        alloc func: alloc_pages_exact_nid
        ...
      
      The output looks mostly same as --alloc (I also added callsite column
      to that) but groups entries by callsite.  Currently, the order,
      migrate type and GFP flag info is for the last allocation and not
      guaranteed to be same for all allocations from the callsite.
      
        ---------------------------------------------------------------------------------------------
         Total_alloc (KB) | Hits      | Order | Mig.type | GFP flags | Callsite
        ---------------------------------------------------------------------------------------------
                    1,064 |       266 |     0 | UNMOVABL |  000000d0 | __pollwait
                       52 |        13 |     0 | UNMOVABL |  002084d0 | pte_alloc_one
                       44 |        11 |     0 |  MOVABLE |  000280da | handle_mm_fault
                       20 |         5 |     0 |  MOVABLE |  000200da | do_cow_fault
                       20 |         5 |     0 |  MOVABLE |  000200da | do_wp_page
                       16 |         4 |     0 | UNMOVABL |  000084d0 | __pmd_alloc
                       16 |         4 |     0 | UNMOVABL |  00000200 | __tlb_remove_page
                       12 |         3 |     0 | UNMOVABL |  000084d0 | __pud_alloc
                        8 |         2 |     0 | UNMOVABL |  00000010 | bio_copy_user_iov
                        4 |         1 |     0 | UNMOVABL |  000200d2 | pipe_write
                        4 |         1 |     0 |  MOVABLE |  000280da | do_wp_page
                        4 |         1 |     0 | UNMOVABL |  002084d0 | pgd_alloc
        ---------------------------------------------------------------------------------------------
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NPekka Enberg <penberg@kernel.org>
      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/1429592107-1807-2-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c9758cc4