Chao Gao 9e02977bfa dma-direct: avoid redundant memory sync for swiotlb
When we looked into FIO performance with swiotlb enabled in VM, we found
swiotlb_bounce() is always called one more time than expected for each DMA
read request.

It turns out that the bounce buffer is copied to original DMA buffer twice
after the completion of a DMA request (one is done by in
dma_direct_sync_single_for_cpu(), the other by swiotlb_tbl_unmap_single()).
But the content in bounce buffer actually doesn't change between the two
rounds of copy. So, one round of copy is redundant.

Pass DMA_ATTR_SKIP_CPU_SYNC flag to swiotlb_tbl_unmap_single() to
skip the memory copy in it.

This fix increases FIO 64KB sequential read throughput in a guest with
swiotlb=force by 5.6%.

Fixes: 55897af63091 ("dma-direct: merge swiotlb_dma_ops into the dma_direct code")
Reported-by: Wang Zhaoyang1 <zhaoyang1.wang@intel.com>
Reported-by: Gao Liang <liang.gao@intel.com>
Signed-off-by: Chao Gao <chao.gao@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2022-04-14 06:30:39 +02:00
..
2022-03-28 12:41:28 -07:00
2022-03-28 17:29:53 -07:00
2022-03-23 18:03:08 -07:00
2021-12-02 17:25:21 +09:00
2022-03-22 14:39:12 -07:00
2022-01-11 09:51:26 -08:00
2022-03-28 17:29:53 -07:00
2022-03-22 13:44:21 -07:00
2022-03-21 16:48:55 -07:00
2022-03-23 10:54:27 -07:00
2022-03-22 14:39:12 -07:00
2022-03-28 17:29:53 -07:00
2022-03-28 17:29:53 -07:00
\n
2021-11-06 16:43:20 -07:00
2022-01-11 13:08:21 -08:00
2022-03-21 20:53:11 -07:00
2021-08-11 13:11:12 -07:00
2021-09-08 15:32:35 -07:00
2022-03-22 14:39:12 -07:00
2022-03-15 10:32:44 +01:00
2022-03-28 17:29:53 -07:00
2021-06-18 11:43:08 +02:00
2022-03-22 14:39:12 -07:00
2021-09-08 15:32:34 -07:00
2022-03-23 18:03:08 -07:00
2022-02-28 10:26:40 -05:00
2021-10-14 13:29:18 +02:00
2022-01-08 12:43:57 -06:00
2022-03-28 17:29:53 -07:00
2022-03-28 17:29:53 -07:00
2022-02-25 09:36:06 +01:00
2022-03-08 14:33:36 -06:00