From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D03C0C32750 for ; Fri, 2 Aug 2019 04:36:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B0103206A2 for ; Fri, 2 Aug 2019 04:36:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729806AbfHBEg5 (ORCPT ); Fri, 2 Aug 2019 00:36:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:45098 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728157AbfHBEg4 (ORCPT ); Fri, 2 Aug 2019 00:36:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 56E85AD2B; Fri, 2 Aug 2019 04:36:53 +0000 (UTC) Subject: Re: [PATCH 20/34] xen: convert put_page() to put_user_page*() To: john.hubbard@gmail.com, Andrew Morton Cc: devel@driverdev.osuosl.org, Dave Chinner , Christoph Hellwig , Dan Williams , Ira Weiny , x86@kernel.org, linux-mm@kvack.org, Dave Hansen , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, devel@lists.orangefs.org, xen-devel@lists.xenproject.org, John Hubbard , Boris Ostrovsky , rds-devel@oss.oracle.com, =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Jan Kara , ceph-devel@vger.kernel.org, kvm@vger.kernel.org, linux-block@vger.kernel.org, linux-crypto@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, LKML , linux-media@vger.kernel.org, linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org, linux-xfs@vger.kernel.org, netdev@vger.kernel.org, sparclinux@vger.kernel.org, Jason Gunthorpe References: <20190802022005.5117-1-jhubbard@nvidia.com> <20190802022005.5117-21-jhubbard@nvidia.com> From: Juergen Gross Message-ID: <4471e9dc-a315-42c1-0c3c-55ba4eeeb106@suse.com> Date: Fri, 2 Aug 2019 06:36:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190802022005.5117-21-jhubbard@nvidia.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 7bit Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On 02.08.19 04:19, john.hubbard@gmail.com wrote: > From: John Hubbard > > 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 > Cc: Juergen Gross > Cc: xen-devel@lists.xenproject.org > Signed-off-by: John Hubbard > --- > 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