diff options
| author | Andrei Vagin <[email protected]> | 2018-04-10 16:30:44 -0700 | 
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2018-04-11 10:28:32 -0700 | 
| commit | 0e3dc019143104a6e676287b1e453cccd7add404 (patch) | |
| tree | b3aa6e165b872e86fdf5be2fe113adae58e2ee6e /fs/proc/array.c | |
| parent | 69ca372c100fba99c78ef826a1795aa86e4f01a8 (diff) | |
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
[[email protected]: use unsigned int instead of int where it is suitable]
  Link: http://lkml.kernel.org/r/[email protected]
[[email protected]: v2]
  Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andrei Vagin <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: KAMEZAWA Hiroyuki <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'fs/proc/array.c')
0 files changed, 0 insertions, 0 deletions