[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4471e9dc-a315-42c1-0c3c-55ba4eeeb106@suse.com>
Date: Fri, 2 Aug 2019 06:36:51 +0200
From: Juergen Gross <jgross@...e.com>
To: john.hubbard@...il.com, Andrew Morton <akpm@...ux-foundation.org>
Cc: devel@...verdev.osuosl.org, Dave Chinner <david@...morbit.com>,
Christoph Hellwig <hch@...radead.org>,
Dan Williams <dan.j.williams@...el.com>,
Ira Weiny <ira.weiny@...el.com>, x86@...nel.org,
linux-mm@...ck.org, Dave Hansen <dave.hansen@...ux.intel.com>,
amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org,
linux-arm-kernel@...ts.infradead.org,
linux-rpi-kernel@...ts.infradead.org, devel@...ts.orangefs.org,
xen-devel@...ts.xenproject.org, John Hubbard <jhubbard@...dia.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
rds-devel@....oracle.com,
Jérôme Glisse <jglisse@...hat.com>,
Jan Kara <jack@...e.cz>, ceph-devel@...r.kernel.org,
kvm@...r.kernel.org, linux-block@...r.kernel.org,
linux-crypto@...r.kernel.org, linux-fbdev@...r.kernel.org,
linux-fsdevel@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
linux-media@...r.kernel.org, linux-nfs@...r.kernel.org,
linux-rdma@...r.kernel.org, linux-xfs@...r.kernel.org,
netdev@...r.kernel.org, sparclinux@...r.kernel.org,
Jason Gunthorpe <jgg@...pe.ca>
Subject: Re: [PATCH 20/34] xen: convert put_page() to put_user_page*()
On 02.08.19 04:19, john.hubbard@...il.com wrote:
> From: John Hubbard <jhubbard@...dia.com>
>
> 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 commit fc1d8e7cca2d
> ("mm: introduce put_user_page*(), placeholder versions").
>
> Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
> Cc: Juergen Gross <jgross@...e.com>
> Cc: xen-devel@...ts.xenproject.org
> Signed-off-by: John Hubbard <jhubbard@...dia.com>
> ---
> drivers/xen/gntdev.c | 5 +----
> drivers/xen/privcmd.c | 7 +------
> 2 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
> index 4c339c7e66e5..2586b3df2bb6 100644
> --- a/drivers/xen/gntdev.c
> +++ b/drivers/xen/gntdev.c
> @@ -864,10 +864,7 @@ static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt,
>
> static void gntdev_put_pages(struct gntdev_copy_batch *batch)
> {
> - unsigned int i;
> -
> - for (i = 0; i < batch->nr_pages; i++)
> - put_page(batch->pages[i]);
> + put_user_pages(batch->pages, batch->nr_pages);
> batch->nr_pages = 0;
> }
>
> diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
> index 2f5ce7230a43..29e461dbee2d 100644
> --- a/drivers/xen/privcmd.c
> +++ b/drivers/xen/privcmd.c
> @@ -611,15 +611,10 @@ static int lock_pages(
>
> static void unlock_pages(struct page *pages[], unsigned int nr_pages)
> {
> - unsigned int i;
> -
> if (!pages)
> return;
>
> - for (i = 0; i < nr_pages; i++) {
> - if (pages[i])
> - put_page(pages[i]);
> - }
> + put_user_pages(pages, nr_pages);
You are not handling the case where pages[i] is NULL here. Or am I
missing a pending patch to put_user_pages() here?
Juergen
Powered by blists - more mailing lists