Skip to content

Commit 6ffecc9

Browse files
alexsierragalexdeucher
authored andcommitted
drm/amdkfd: skip migration for pages already in VRAM
Migration skipped for pages that are already in VRAM domain. These could be the result of previous partial migrations to SYS RAM, and prefetch back to VRAM. Ex. Coherent pages in VRAM that were not written/invalidated after a copy-on-write. Signed-off-by: Alex Sierra <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 1ade5f8 commit 6ffecc9

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

drivers/gpu/drm/amd/amdkfd/kfd_migrate.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,13 @@ svm_migrate_copy_to_vram(struct amdgpu_device *adev, struct svm_range *prange,
293293
for (i = j = 0; i < npages; i++) {
294294
struct page *spage;
295295

296-
dst[i] = cursor.start + (j << PAGE_SHIFT);
297-
migrate->dst[i] = svm_migrate_addr_to_pfn(adev, dst[i]);
298-
svm_migrate_get_vram_page(prange, migrate->dst[i]);
299-
300-
migrate->dst[i] = migrate_pfn(migrate->dst[i]);
301-
migrate->dst[i] |= MIGRATE_PFN_LOCKED;
302-
303-
if (migrate->src[i] & MIGRATE_PFN_VALID) {
304-
spage = migrate_pfn_to_page(migrate->src[i]);
296+
spage = migrate_pfn_to_page(migrate->src[i]);
297+
if (spage && !is_zone_device_page(spage)) {
298+
dst[i] = cursor.start + (j << PAGE_SHIFT);
299+
migrate->dst[i] = svm_migrate_addr_to_pfn(adev, dst[i]);
300+
svm_migrate_get_vram_page(prange, migrate->dst[i]);
301+
migrate->dst[i] = migrate_pfn(migrate->dst[i]);
302+
migrate->dst[i] |= MIGRATE_PFN_LOCKED;
305303
src[i] = dma_map_page(dev, spage, 0, PAGE_SIZE,
306304
DMA_TO_DEVICE);
307305
r = dma_mapping_error(dev, src[i]);

0 commit comments

Comments
 (0)