Re: [RFC PATCH 2/2] mm/gup: introduce vaddr_pin_pages_remote()
From: John Hubbard
Date: Fri Aug 16 2019 - 18:36:23 EST
On 8/16/19 2:59 PM, Ira Weiny wrote:
> On Fri, Aug 16, 2019 at 11:50:09AM -0700, John Hubbard wrote:
...
>>> John could you send a formal patch using vaddr_pin* and I'll add it to the
>>> tree?
>>>
>>
>> Yes...hints about which struct file to use here are very welcome, btw. This part
>> of mm is fairly new to me.
>
> I'm still working out the final semantics of vaddr_pin*. But right now you
> don't need a vaddr_pin if you don't specify FOLL_LONGTERM.
>
ah OK.
> Since case 1, this case, does not need FOLL_LONGTERM I think it is safe to
> simply pass NULL here.
>
> OTOH we could just track this against the mm_struct. But I don't think we need
> to because this pin should be transient.
>
Thanks for looking at that, I'm definitely in learning mode here.
> And this is why I keep leaning toward _not_ putting these flags in the
> vaddr_pin*() calls. I know this is what I did but I think I'm wrong. It should
> be the caller specifying what they want and the vaddr_pin*() calls check that
> what they are asking for is correct.
>
Yes. I think we're nearly done finding the right balance of wrapper calls and
FOLL_* flags. I've seen Jan and others asking that the call sites do *not*
set the flags, but we also know that FOLL_PIN and FOLL_LONGTERM need to vary
independently.
That means either:
a) another trivial wrapper calls, on top of vaddr_pin_*(), for each supported
combination of FOLL_PIN and FOLL_LONGTERM, or
b) just setting FOLL_PIN and FOLL_LONGTERM at each callsite.
I think either way is easy to grep for, so it's hard to get too excited
(fortunately) about which one to pick. Let's start simple with (b) and it's
easy to convert later if someone wants that.
Meanwhile, we do need to pull the flag setting out of vaddr_pin_pages().
So I will post these small patches for your mmotm-rdmafsdax-b0-v4 branch,
shortly:
1) Add FOLL_PIN
--also I guess it's time to add comments documenting FOLL_PIN and
FOLL_LONGTERM use, stealing Jan's and others' wording for the 4 cases,
from earlier. :)
2) Add vaddr_pin_user_pages_remote(), which will not set FOLL_PIN or FOLL_LONGTERM
itself. And add the caller, which will.
thanks,
--
John Hubbard
NVIDIA