summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorchenhuguanshen <chenhgs@chinatelecom.cn>2026-08-12 15:04:59 +0800
committerMarek Szyprowski <m.szyprowski@samsung.com>2026-08-13 08:02:35 +0200
commit121f9fd1c3083312055126205f3e40b8ee999fe6 (patch)
treec6eaf65fb285e65972a61c4e0a0d994773cbd08e /include/linux
parent298d312c0ff3f49061316ba799257277f4bb9bc4 (diff)
downloadlinux-next-121f9fd1c3083312055126205f3e40b8ee999fe6.tar.gz
linux-next-121f9fd1c3083312055126205f3e40b8ee999fe6.zip
dma/swiotlb: decouple high watermark tracking from CONFIG_DEBUG_FS
Under heavy concurrent DMA traffic on CoCo VMs, inc_used_and_hiwater() performs an atomic_long_add_return() plus a CAS loop on the global used_hiwater, and dec_used() performs an atomic_long_sub() on total_used. All CPUs contend on the same cacheline, causing measurable throughput degradation at scale. Historically these counters were only compiled in under CONFIG_DEBUG_FS, which means production kernels with debugfs paid the atomic overhead unconditionally. Make the tracking boot-time opt-in instead so that it is disabled by default with near-zero overhead via static_call, and can be enabled via "swiotlb=track_hiwater" parameter on demand for debugging. Note that when CONFIG_DEBUG_FS is enabled but hiwater tracking is disabled, the "io_tlb_used" metric reports an approximate value rather than an instantaneously exact one. Suggested-by: Fan Du <fan.du@intel.com> Signed-off-by: Jun Miao <jun.miao@intel.com> Co-developed-by: Fan Du <fan.du@intel.com> Signed-off-by: Fan Du <fan.du@intel.com> Tested-by: chenhuguanshen <chenhgs@chinatelecom.cn> Signed-off-by: chenhuguanshen <chenhgs@chinatelecom.cn> Reviewed-by: Michael Kelley <mhklinux@outlook.com> Tested-by: Michael Kelley <mhklinux@outlook.com> Link: https://lore.kernel.org/r/20260812070459.637077-1-frankchen158@126.com Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/swiotlb.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 1665a9ce8f94..318bb1beb07f 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -102,10 +102,10 @@ struct io_tlb_pool {
* @pools: List of IO TLB memory pool descriptors (if dynamic).
* @dyn_alloc: Dynamic IO TLB pool allocation work.
* @total_used: The total number of slots in the pool that are currently used
- * across all areas. Used only for calculating used_hiwater in
- * debugfs.
- * @used_hiwater: The high water mark for total_used. Used only for reporting
- * in debugfs.
+ * across all areas. Used only for calculating used_hiwater via boot
+ * parameter swiotlb=track_hiwater and exposed via debugfs.
+ * @used_hiwater: The high water mark for total_used. Can be enabled at boot
+ * time via swiotlb=track_hiwater and exposed via debugfs.
* @transient_nslabs: The total number of slots in all transient pools that
* are currently used across all areas.
*/