]> www.infradead.org Git - users/hch/dma-mapping.git/commit
swiotlb: track and report io_tlb_used high water marks in debugfs
authorMichael Kelley <mikelley@microsoft.com>
Thu, 13 Apr 2023 17:57:37 +0000 (10:57 -0700)
committerChristoph Hellwig <hch@lst.de>
Sun, 16 Apr 2023 06:25:29 +0000 (08:25 +0200)
commit8b0977ecc8b30a30966e76fcb64cef5041626b02
tree03dd9c0b0e6db4deb953e00c97b0a8c617264866
parent5499d01c029069044a3b3e50501c77b474c96178
swiotlb: track and report io_tlb_used high water marks in debugfs

swiotlb currently reports the total number of slabs and the instantaneous
in-use slabs in debugfs. But with increased usage of swiotlb for all I/O
in Confidential Computing (coco) VMs, it has become difficult to know
how much memory to allocate for swiotlb bounce buffers, either via the
automatic algorithm in the kernel or by specifying a value on the
kernel boot line. The current automatic algorithm generously allocates
swiotlb bounce buffer memory, and may be wasting significant memory in
many use cases.

To support better understanding of swiotlb usage, add tracking of the
the high water mark for usage of the default swiotlb bounce buffer memory
pool and any reserved memory pools. Report these high water marks in
debugfs along with the other swiotlb pool metrics.  Allow the high water
marks to be reset to zero at runtime by writing to them.

Signed-off-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
include/linux/swiotlb.h
kernel/dma/swiotlb.c