linux/include
Andrei Vagin 0e3dc01914 procfs: add seq_put_hex_ll to speed up /proc/pid/maps
seq_put_hex_ll() prints a number in hexadecimal notation and works
faster than seq_printf().

== test.py
  num = 0
  with open("/proc/1/maps") as f:
          while num < 10000 :
                  data = f.read()
                  f.seek(0, 0)
                 num = num + 1
==

== Before patch ==
  $  time python test.py

  real	0m1.561s
  user	0m0.257s
  sys	0m1.302s

== After patch ==
  $ time python test.py

  real	0m0.986s
  user	0m0.279s
  sys	0m0.707s

$ perf -g record python test.py:

== Before patch ==
-   67.42%     2.82%  python   [kernel.kallsyms] [k] show_map_vma.isra.22
   - 64.60% show_map_vma.isra.22
      - 44.98% seq_printf
         - seq_vprintf
            - vsnprintf
               + 14.85% number
               + 12.22% format_decode
                 5.56% memcpy_erms
      + 15.06% seq_path
      + 4.42% seq_pad
   + 2.45% __GI___libc_read

== After patch ==
-   47.35%     3.38%  python   [kernel.kallsyms] [k] show_map_vma.isra.23
   - 43.97% show_map_vma.isra.23
      + 20.84% seq_path
      - 15.73% show_vma_header_prefix
           10.55% seq_put_hex_ll
         + 2.65% seq_put_decimal_ull
           0.95% seq_putc
      + 6.96% seq_pad
   + 2.94% __GI___libc_read

[avagin@openvz.org: use unsigned int instead of int where it is suitable]
  Link: http://lkml.kernel.org/r/20180214025619.4005-1-avagin@openvz.org
[avagin@openvz.org: v2]
  Link: http://lkml.kernel.org/r/20180117082050.25406-1-avagin@openvz.org
Link: http://lkml.kernel.org/r/20180112185812.7710-1-avagin@openvz.org
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-04-11 10:28:32 -07:00
..
acpi pci-v4.17-changes 2018-04-06 18:31:06 -07:00
asm-generic ARM: 2018-04-09 11:42:31 -07:00
clocksource ARM: SoC platform updates for 4.17 2018-04-05 21:21:08 -07:00
crypto crypto: api - Remove unused crypto_type lookup function 2018-03-31 01:32:57 +08:00
drm Linux 4.16-rc7 2018-03-28 14:30:41 +10:00
dt-bindings ARM: SoC driver updates for 4.17 2018-04-05 21:29:35 -07:00
keys
kvm kvm/arm fixes for 4.16, take 2 2018-03-19 17:43:01 +00:00
linux procfs: add seq_put_hex_ll to speed up /proc/pid/maps 2018-04-11 10:28:32 -07:00
math-emu
media media updates for v4.17-rc1 2018-04-10 10:10:30 -07:00
memory
misc powerpc updates for 4.16 2018-02-02 10:01:04 -08:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-04-09 17:04:10 -07:00
pcmcia
ras
rdma Merge candidates for 4.17 merge window 2018-04-06 17:35:43 -07:00
scsi SCSI for-linus on 20180404 2018-04-05 15:05:53 -07:00
soc ARM: SoC driver updates for 4.17 2018-04-05 21:29:35 -07:00
sound sound updates for 4.17-rc1 2018-04-05 10:42:07 -07:00
target
trace mm, vmscan, tracing: use pointer to reclaim_stat struct in trace event 2018-04-11 10:28:30 -07:00
uapi ARM: 2018-04-09 11:42:31 -07:00
video video: of: display_timing: Remove of_display_timings_exist() function 2018-03-12 17:06:54 +01:00
xen