diff options
| author | Andrei Vagin <[email protected]> | 2018-04-10 23:30:47 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2018-04-11 17:28:32 +0000 |
| commit | 8cfa67b4d9a9d9a6061f3cfd0e0ed16e66e45984 (patch) | |
| tree | cf95174279e04babd3bc9feb8f64179ca7257259 /fs/proc/array.c | |
| parent | procfs: add seq_put_hex_ll to speed up /proc/pid/maps (diff) | |
| download | kernel-8cfa67b4d9a9d9a6061f3cfd0e0ed16e66e45984.tar.gz kernel-8cfa67b4d9a9d9a6061f3cfd0e0ed16e66e45984.zip | |
procfs: optimize seq_pad() to speed up /proc/pid/maps
seq_printf() is slow and it can be replaced by memset() in this case.
== 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 0m0.986s
user 0m0.279s
sys 0m0.707s
== After patch ==
$ time python test.py
real 0m0.932s
user 0m0.261s
sys 0m0.669s
$ perf record -g python test.py
== Before 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
+ 6.96% seq_pad
+ 2.94% __GI___libc_read
== After patch ==
- 44.01% 0.34% python [kernel.kallsyms] [k] show_pid_map
- 43.67% show_pid_map
- 42.91% show_map_vma.isra.23
+ 21.55% seq_path
- 15.68% show_vma_header_prefix
+ 2.08% seq_pad
0.55% seq_putc
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
