linux-stable/include
Alistair Popple e778406b40 mm/migrate_device.c: add migrate_device_range()
Device drivers can use the migrate_vma family of functions to migrate
existing private anonymous mappings to device private pages.  These pages
are backed by memory on the device with drivers being responsible for
copying data to and from device memory.

Device private pages are freed via the pgmap->page_free() callback when
they are unmapped and their refcount drops to zero.  Alternatively they
may be freed indirectly via migration back to CPU memory in response to a
pgmap->migrate_to_ram() callback called whenever the CPU accesses an
address mapped to a device private page.

In other words drivers cannot control the lifetime of data allocated on
the devices and must wait until these pages are freed from userspace. 
This causes issues when memory needs to reclaimed on the device, either
because the device is going away due to a ->release() callback or because
another user needs to use the memory.

Drivers could use the existing migrate_vma functions to migrate data off
the device.  However this would require them to track the mappings of each
page which is both complicated and not always possible.  Instead drivers
need to be able to migrate device pages directly so they can free up
device memory.

To allow that this patch introduces the migrate_device family of functions
which are functionally similar to migrate_vma but which skips the initial
lookup based on mapping.

Link: https://lkml.kernel.org/r/868116aab70b0c8ee467d62498bb2cf0ef907295.1664366292.git-series.apopple@nvidia.com
Signed-off-by: Alistair Popple <apopple@nvidia.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Yang Shi <shy828301@gmail.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Ralph Campbell <rcampbell@nvidia.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Alex Sierra <alex.sierra@amd.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-10-12 18:51:49 -07:00
..
acpi Merge branch 'acpi-properties' 2022-08-11 19:21:03 +02:00
asm-generic asm-generic: instrument usercopy in cacheflush.h 2022-10-03 14:03:18 -07:00
clocksource
crypto for-5.20/block-2022-08-04 2022-08-04 20:00:14 -07:00
drm
dt-bindings power supply and reset changes for the v6.0 series 2022-08-12 09:37:33 -07:00
keys
kunit
kvm
linux mm/migrate_device.c: add migrate_device_range() 2022-10-12 18:51:49 -07:00
math-emu
media SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
memory
misc
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf 2022-08-24 19:18:10 -07:00
pcmcia
ras mm, hwpoison: enable memory error handling on 1GB hugepage 2022-08-08 18:06:44 -07:00
rdma dma-mapping updates 2022-08-06 10:56:45 -07:00
rv
scsi SCSI misc on 20220813 2022-08-13 13:41:48 -07:00
soc net: mscc: ocelot: keep ocelot_stat_layout by reg address, not offset 2022-08-17 21:58:32 -07:00
sound
target
trace mm/khugepaged: add tracepoint to hpage_collapse_scan_file() 2022-10-03 14:03:33 -07:00
uapi hugetlb_encode.h: fix undefined behaviour (34 << 26) 2022-10-03 14:02:55 -07:00
ufs scsi: ufs: core: Enable link lost interrupt 2022-08-11 22:04:32 -04:00
vdso
video
xen x86/xen: Add support for HVMOP_set_evtchn_upcall_vector 2022-08-12 11:28:21 +02:00