summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@c-s.fr>2017-12-18 11:08:35 +0100
committerLinus Walleij <linus.walleij@linaro.org>2017-12-20 10:34:58 +0100
commit1efba35afae43094d3f26093f5f1ab8a46686a6f (patch)
tree5f0cc54ea8cd6826f8daa5d17410b7c9e6f19f8f /tools
parent7a94b88cb7087aa3184161bedccfea25e5502c62 (diff)
downloadlinux-1efba35afae43094d3f26093f5f1ab8a46686a6f.tar.gz
gpio: sysfs: avoid using kstrtol() in 'value' attribute write
A 'perf record' on an app continuously writing in the 'value'
attribute show that most of the time is spent in kstrtol()

--17.99%--value_store
          |
          |--10.17%--kstrtoint
          |          |
          |          |--8.82%--kstrtoll
          |
          |--2.50%--gpiod_set_value_cansleep
          |
          |--1.82%--u16_gpio_set
          |
          |--1.46%--value_store

The normal case is to write 0 or 1 in the attribute, therefore
this patch avoids the call to kstrtol() in the most common cases

Then 'perf record' shows

--7.21%--value_store
          |
          |--2.69%--u16_gpio_set
          |
          |--1.47%--value_store
          |
          |--1.08%--gpiod_set_value_cansleep
          |
          |--0.60%--mutex_lock
          |
           --0.58%--mutex_unlock

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions