Re: [PATCH] regcache: Push async I/O request down into the rbtree cache

From: Charles Keepax
Date: Wed Jul 19 2023 - 04:40:29 EST


On Wed, Jul 19, 2023 at 12:30:40AM +0100, Mark Brown wrote:
> Currently the regcache core unconditionally enables async I/O for all cache
> types, causing problems for the maple tree cache which dynamically allocates
> the buffers used to write registers to the device since async requires the
> buffers to be kept around until the I/O has been completed.
>
> This use of async I/O is mainly for the rbtree cache which stores data in
> a format directly usable for regmap_raw_write(), though there is a special
> case for single register writes which would also have allowed it to be used
> with the flat cache. It is a bit of a landmine for other caches since it
> implicitly converts sync operations to async, and with modern hardware it
> is not clear that async I/O is actually a performance win as shown by the
> performance work David Jander did with SPI. In multi core systems the cost
> of managing concurrency ends up swamping the performance benefit and almost
> all modern systems are multi core.
>
> Address this by pushing the enablement of async I/O down into the rbtree
> cache where it is actively used, avoiding surprises for other cache
> implementations.
>
> Reported-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
> Fixes: bfa0b38c1483 ("regmap: maple: Implement block sync for the maple tree cache")
> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
> ---

Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
Tested-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>

Thanks,
Charles