From 9296adcd450143f02faf32fbda5b77dba3f03bc7 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Thu, 2 Jun 2022 14:29:53 -0400 Subject: gpu-paging: Allow for more than one buffer to be swapped at a time This uses a very primitive linear disk sector allocation scheme. Sectors are only reused when userspace resets assignment to 0 with an NVGPU_AS_IOCTL_SWAP_RESET ioctl (which invalidates all current swap buffers). This sector assignment scheme is sufficient for use in a TimeWall- like system, where all allocations are assumed to be static after after task system release. This is not suitable for a system with dynamic allocations, unless userspace manually resets swap state regularly (benchmarks run a reset at start for example). Support for dynamic allocations is on the backlog. No significant speed impact. Benchmarks, 100 iters, after: gpu_paging_speed, write: 186.0ms +/- 3.51 gpu_paging_speed, read: 162.7ms +/- 2.58 gpu_paging_overhead_speed, write start: 35.4ms +/- 4.47 gpu_paging_overhead_speed, write finish: 3.3ms +/- 0.18 gpu_paging_overhead_speed, read start: 69.8ms +/- 6.42 gpu_paging_overhead_speed, read finish: 43.2ms +/- 0.91 --- drivers/gpu/nvgpu/include/nvgpu/linux/vm.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/gpu/nvgpu/include') diff --git a/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h b/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h index 85abce6f..4fa4242c 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h +++ b/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h @@ -51,7 +51,10 @@ struct nvgpu_mapped_buf_priv { struct sg_table *sgt; // For fast reverse lookup (FD -> mapped_buf) struct list_head nvmap_priv_entry; + // To allow waiting on swap I/O completion struct completion swap_io_done; + // Sector assignment for swapped-out data + sector_t swap_sector; }; /* NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL must be set */ -- cgit v1.2.2