[PATCH v2 2/3] mm/gup.c: Migrate device coherent pages when pinning instead of failing
Alistair Popple
apopple at nvidia.com
Mon Feb 14 00:05:50 UTC 2022
John Hubbard <jhubbard at nvidia.com> writes:
> On 2/11/22 18:51, Alistair Popple wrote:
[…]
>>> See below…
>>>
>>>> + }
>>>> +
>>>> + pages[i] = migrate_device_page(head, gup_flags);
>> migrate_device_page() will return a new page that has been correctly pinned
>> with gup_flags by try_grab_page(). Therefore this page can still be released
>> with unpin_user_page() or put_page() as appropriate for the given gup_flags.
>> The reference we had on the source page (head) always gets dropped in
>> migrate_vma_finalize().
>
> OK. Good.
>
> The above would be good to have in a comment, right around here, imho.
> Because we have this marvelous mix of references for migration (get_page())
> and other, and it’s a bit hard to see that it’s all correct without a
> hint or two.
Ok, will do.
>
> …
>> Which unless I’ve missed something is still the correct thing to do.
>>
>>> This reminds me: out of the many things to monitor, the FOLL_PIN counts
>>> in /proc/vmstat are especially helpful, whenever making changes to code
>>> that deals with this:
>>>
>>> nr_foll_pin_acquired
>>> nr_foll_pin_released
>>>
>>> …and those should normally be equal to each other when “at rest”.
>>>
>
> I hope this is/was run, just to be sure?
Thanks for the suggestion, these remain equal to each other after running
hmm-tests which confirms everything is working as expected.
>
> thanks,
More information about the amd-gfx
mailing list