WSL2-Linux-Kernel/tools/vm
Naoya Horiguchi d9b2ddf807 tools/vm/page-types.c: avoid memset() in walk_pfn() when count == 1
I found that page-types is very slow and my testing shows many timeout
errors.  Here's an example with a simple program allocating 1000 thps.

  $ time ./page-types -p $(pgrep -f test_alloc)
  ...
  real    0m17.201s
  user    0m16.889s
  sys     0m0.312s

Most of time is spent in memset().  Currently memset() clears over whole
buffer for every walk_pfn() call, which is inefficient when walk_pfn()
is called from walk_vma(), because in that case walk_pfn() is called for
each pfn.  So this patch limits the zero initialization only for the
first element.

  $ time ./page-types.patched -p $(pgrep -f test_alloc)
  ...
  real    0m0.182s
  user    0m0.046s
  sys     0m0.135s

Fixes: 954e95584579 ("tools/vm/page-types.c: add memory cgroup dumping and filtering")
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Suggested-by: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-03-17 15:09:34 -07:00
..
.gitignore tools/vm: add .gitignore to ignore built binaries 2013-02-05 20:38:46 +11:00
Makefile tools/vm: fix page-flags build 2015-05-14 17:55:51 -07:00
page-types.c tools/vm/page-types.c: avoid memset() in walk_pfn() when count == 1 2016-03-17 15:09:34 -07:00
page_owner_sort.c mm/page_owner: keep track of page owners 2014-12-13 12:42:48 -08:00
slabinfo-gnuplot.sh tools/vm/slabinfo: gnuplot slabifo extended stat 2015-11-05 19:34:48 -08:00
slabinfo.c slub: convert SLAB_DEBUG_FREE to SLAB_CONSISTENCY_CHECKS 2016-03-15 16:55:16 -07:00