diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-05-07 14:13:46 +0200 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-05-07 18:04:23 +0200 |
commit | a86d27693066a34a29be86f394bbad847b2d1749 (patch) | |
tree | 64514921609b6e0c9e38c77f7c678e75b7343c40 /drivers/gpio/gpio-mt7621.c | |
parent | e67572cd2204894179d89bd7b984072f19313b03 (diff) | |
download | lwn-a86d27693066a34a29be86f394bbad847b2d1749.tar.gz lwn-a86d27693066a34a29be86f394bbad847b2d1749.zip |
gpiolib: fix the speed of descriptor label setting with SRCU
Commit 1f2bcb8c8ccd ("gpio: protect the descriptor label with SRCU")
caused a massive drop in performance of requesting GPIO lines due to the
call to synchronize_srcu() on each label change. Rework the code to not
wait until all read-only users are done with reading the label but
instead atomically replace the label pointer and schedule its release
after all read-only critical sections are done.
To that end wrap the descriptor label in a struct that also contains the
rcu_head struct required for deferring tasks using call_srcu() and stop
using kstrdup_const() as we're required to allocate memory anyway. Just
allocate enough for the label string and rcu_head in one go.
Reported-by: Neil Armstrong <neil.armstrong@linaro.org>
Closes: https://lore.kernel.org/linux-gpio/CAMRc=Mfig2oooDQYTqo23W3PXSdzhVO4p=G4+P8y1ppBOrkrJQ@mail.gmail.com/
Fixes: 1f2bcb8c8ccd ("gpio: protect the descriptor label with SRCU")
Suggested-by: "Paul E. McKenney" <paulmck@kernel.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Acked-by: "Paul E. McKenney" <paulmck@kernel.org>
Link: https://lore.kernel.org/r/20240507121346.16969-1-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-mt7621.c')
0 files changed, 0 insertions, 0 deletions