net/xdp: convert put_page() to put_user_page*()
authorJohn Hubbard <jhubbard@nvidia.com>
Mon, 23 Sep 2019 22:35:10 +0000 (15:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 24 Sep 2019 22:54:08 +0000 (15:54 -0700)
For pages that were retained via get_user_pages*(), release those pages
via the new put_user_page*() routines, instead of via put_page() or
release_pages().

This is part a tree-wide conversion, as described in fc1d8e7cca2d ("mm:
introduce put_user_page*(), placeholder versions").

Link: http://lkml.kernel.org/r/20190724044537.10458-4-jhubbard@nvidia.com
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Cc: Björn Töpel <bjorn.topel@intel.com>
Cc: Magnus Karlsson <magnus.karlsson@intel.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
net/xdp/xdp_umem.c

index 947b8ff0227e64ad190116178a2e6c9c4a154102..bba3104f128f1abf04154085380b1ac24428dcff 100644 (file)
@@ -206,14 +206,7 @@ static int xdp_umem_map_pages(struct xdp_umem *umem)
 
 static void xdp_umem_unpin_pages(struct xdp_umem *umem)
 {
-       unsigned int i;
-
-       for (i = 0; i < umem->npgs; i++) {
-               struct page *page = umem->pgs[i];
-
-               set_page_dirty_lock(page);
-               put_page(page);
-       }
+       put_user_pages_dirty_lock(umem->pgs, umem->npgs, true);
 
        kfree(umem->pgs);
        umem->pgs = NULL;