apple-nvme: defer cache flushes by a specified amount
authorJens Axboe <axboe@kernel.dk>
Wed, 16 Feb 2022 19:17:58 +0000 (12:17 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 16 Feb 2022 20:30:11 +0000 (13:30 -0700)
commitb27dc7ae39cb21a695b171d27c49435338a8b5e8
tree3f72912b5a5cc0eff43fd482e73f23d6f3d96ad9
parente493225b2692e663729a79754065c3fcbe2d3243
apple-nvme: defer cache flushes by a specified amount

Cache flushes on the M1 nvme are really slow, taking 17-18 msec to
complete. This can slow down workloads considerably, pure random writes
end up being bound by the flush latency and hence run at 55-60 IOPS.

Add a deferred flush work around to provide better performance, at a
minimal risk. By default, flushes are delayed at most 1 second, but this
is configurable.

With this work-around, a pure random write workload runs at ~12K IOPS
rather than 56 IOPS.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/apple.c