On 1/31/22 04:05, Jan Kara wrote:
On Sun 30-01-22 21:17:52, John Hubbard wrote:
Unraveling the rat's nest set of APIs in mm/gup.c a bit more.
get_user_pages_locked() was not helping at all, so remove it.
Also, lookup_node() has only a single caller, but it is still worth
having a clearer locking policy there. Changing it so that the caller
both takes and releases the mmap_lock, thus leaving lookup_node() with
the sole job of translating a virtual address into a numa node ID.
Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
Well, the point of _locked() GUP variants is that we can unlock mmap_sem
when reading a page from the disk during a page fault (hidden behind
VM_FAULT_RETRY). So as such _locked() variants are about reducing mmap_sem
latency rather than code readability. In this particular case, I don't
think using _locked() variant in lookup_node() is very beneficial
(generally I would not expect to take a fault there) but at least a
justification in the commit message should be different :).
Honza
I'll rewrite this commit description to cover this point properly.
Jason also suggested using gup-fast, which I like.
thanks,
--
John Hubbard
NVIDIA