[PATCH v9 06/14] mm/gup: migrate device coherent pages when pinning instead of failing
David Hildenbrand
david at redhat.com
Mon Jul 18 10:56:29 UTC 2022
On 15.07.22 17:05, Alex Sierra wrote:
> From: Alistair Popple <apopple at nvidia.com>
>
> Currently any attempts to pin a device coherent page will fail. This is
> because device coherent pages need to be managed by a device driver, and
> pinning them would prevent a driver from migrating them off the device.
>
> However this is no reason to fail pinning of these pages. These are
> coherent and accessible from the CPU so can be migrated just like
> pinning ZONE_MOVABLE pages. So instead of failing all attempts to pin
> them first try migrating them out of ZONE_DEVICE.
>
> [hch: rebased to the split device memory checks,
> moved migrate_device_page to migrate_device.c]
>
> Signed-off-by: Alistair Popple <apopple at nvidia.com>
> Acked-by: Felix Kuehling <Felix.Kuehling at amd.com>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
[...]
> /*
> * Try to move out any movable page before pinning the range.
> */
> @@ -1919,7 +1948,8 @@ static long check_and_migrate_movable_pages(unsigned long nr_pages,
> folio_nr_pages(folio));
> }
>
> - if (!list_empty(&movable_page_list) || isolation_error_count)
> + if (!list_empty(&movable_page_list) || isolation_error_count
> + || coherent_pages)
The common style is to
a) add the || to the end of the previous line
b) indent such the we have a nice-to-read alignment
if (!list_empty(&movable_page_list) || isolation_error_count ||
coherent_pages)
Apart from that lgtm.
Reviewed-by: David Hildenbrand <david at redhat.com>
--
Thanks,
David / dhildenb
More information about the dri-devel
mailing list