spi: spi.c: Convert statistics to per-cpu u64_stats_t
authorDavid Jander <david@protonic.nl>
Tue, 24 May 2022 09:18:08 +0000 (11:18 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 6 Jun 2022 11:41:31 +0000 (12:41 +0100)
commit6598b91b5ac32bc756d7c3000a31f775d4ead1c4
tree9bf8f2c1b9739bdbe5cf57ad90d6f336ceb99e09
parentb658be56e867061a0d5496e837f350974ada5c89
spi: spi.c: Convert statistics to per-cpu u64_stats_t

This change gives a dramatic performance improvement in the hot path,
since many costly spin_lock_irqsave() calls can be avoided.

On an i.MX8MM system with a MCP2518FD CAN controller connected via SPI,
the time the driver takes to handle interrupts, or in other words the time
the IRQ line of the CAN controller stays low is mainly dominated by the
time it takes to do 3 relatively short sync SPI transfers. The effect of
this patch is a reduction of this time from 136us down to only 98us.

Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David Jander <david@protonic.nl>
Link: https://lore.kernel.org/r/20220524091808.2269898-1-david@protonic.nl
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c
include/linux/spi/spi.h