kernel-ark/tools/perf
Namhyung Kim 0d68bc92c4 perf kmem: Analyze page allocator events also
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: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo 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.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-04-13 11:44:52 -03:00
..
arch perf build: Add arch sparc objects building 2015-02-12 13:22:01 -03:00
bench Merge 'tip/perf/urgent' into perf/core to pick fixes 2015-03-02 11:45:49 -03:00
config perf build: Disable libbabeltrace check by default 2015-03-30 10:24:27 -03:00
Documentation perf kmem: Analyze page allocator events also 2015-04-13 11:44:52 -03:00
python
scripts perf build: Add scripts objects building 2015-02-12 11:49:53 -03:00
tests perf tools: Add 'I' event modifier for exclude_idle bit 2015-04-08 11:00:16 -03:00
ui perf hists browser: Indicate which callchain entries are annotated 2015-03-21 14:53:37 -03:00
util perf evlist: Fix type for references to data_head/tail 2015-04-10 11:29:20 -03:00
.gitignore perf build: Use FEATURE-DUMP instead of PERF-FEATURES in the .gitignore file 2015-03-20 17:49:51 -03:00
Build perf tools: Add new 'perf data' command 2015-02-25 12:42:25 -03:00
builtin-annotate.c perf ordered_events: Shorten function signatures 2015-03-11 10:17:09 -03:00
builtin-bench.c
builtin-buildid-cache.c perf buildid-cache: Show usage with incorrect params 2015-02-27 15:52:40 -03:00
builtin-buildid-list.c perf ordered_events: Shorten function signatures 2015-03-11 10:17:09 -03:00
builtin-data.c perf data: Support using -f to override perf.data file ownership for 'convert' 2015-04-02 13:18:52 -03:00
builtin-diff.c perf diff: Add kallsyms option 2015-03-24 13:01:54 -03:00
builtin-evlist.c perf evlist: Support using -f to override perf.data file ownership 2015-04-02 13:18:45 -03:00
builtin-help.c perf tools: Add the bash completion for listing subsubcommands of perf help 2015-03-19 13:49:39 -03:00
builtin-inject.c perf inject: Support using -f to override perf.data file ownership 2015-04-02 13:18:45 -03:00
builtin-kmem.c perf kmem: Analyze page allocator events also 2015-04-13 11:44:52 -03:00
builtin-kvm.c perf kvm: Support using -f to override perf.data.guest file ownership 2015-04-02 13:18:47 -03:00
builtin-list.c perf list: Extend raw-dump to certain kind of events 2015-02-27 15:52:24 -03:00
builtin-lock.c perf lock: Support using -f to override perf.data file ownership 2015-04-02 13:18:48 -03:00
builtin-mem.c perf mem: Support using -f to override perf.data file ownership 2015-04-02 13:18:49 -03:00
builtin-probe.c perf probe: Check the orphaned -x option 2015-04-10 10:21:30 -03:00
builtin-record.c perf evlist: Fix type for references to data_head/tail 2015-04-10 11:29:20 -03:00
builtin-report.c perf report: Don't call map__kmap if map is NULL. 2015-04-08 11:00:00 -03:00
builtin-sched.c perf sched replay: Use replay_repeat to calculate the runavg of cpu usage instead of the default value 10 2015-04-08 09:07:27 -03:00
builtin-script.c perf script: Support using -f to override perf.data file ownership 2015-04-02 13:18:50 -03:00
builtin-stat.c perf evlist: Return the first evsel with an invalid filter in apply_filters() 2015-03-26 10:52:28 -03:00
builtin-timechart.c perf timechart: Support using -f to override perf.data file ownership 2015-04-02 13:18:50 -03:00
builtin-top.c perf symbols: Save DSO loading errno to better report errors 2015-03-24 12:08:43 -03:00
builtin-trace.c perf trace: Support using -f to override perf.data file ownership 2015-04-02 13:18:51 -03:00
builtin.h perf tools: Add new 'perf data' command 2015-02-25 12:42:25 -03:00
command-list.txt perf tools: Add new 'perf data' command 2015-02-25 12:42:25 -03:00
CREDITS
design.txt
Makefile perf tools: Set JOBS based on CPU or processor 2015-03-26 10:52:28 -03:00
Makefile.perf perf build: Disable libbabeltrace check by default 2015-03-30 10:24:27 -03:00
MANIFEST
perf-archive.sh
perf-completion.sh perf tools: Avoid confusion with preloaded bash function for perf bash completion 2015-03-19 13:53:27 -03:00
perf-read-vdso.c
perf-sys.h
perf-with-kcore.sh
perf.c perf tools: Fix the bash completion problem of 'perf --*' 2015-02-27 15:52:28 -03:00
perf.h perf record: Add clockid parameter 2015-04-08 10:04:55 -03:00