From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH 1/3] drivers/gpu/drm/via: convert put_page() to put_user_page*() Date: Mon, 22 Jul 2019 11:33:55 +0200 Message-ID: <20190722093355.GB29538@lst.de> References: <20190722043012.22945-1-jhubbard@nvidia.com> <20190722043012.22945-2-jhubbard@nvidia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190722043012.22945-2-jhubbard@nvidia.com> Sender: netdev-owner@vger.kernel.org To: john.hubbard@gmail.com Cc: Andrew Morton , Alexander Viro , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Boaz Harrosh , Christoph Hellwig , Daniel Vetter , Dan Williams , Dave Chinner , David Airlie , "David S . Miller" , Ilya Dryomov , Jan Kara , Jason Gunthorpe , Jens Axboe , =?iso-8859-1?B?Suly9G1l?= Glisse , Johannes Thumshirn , Magnus Karlsson , Matthew Wilcox , Miklos Szeredi , Ming Lei List-Id: dri-devel@lists.freedesktop.org On Sun, Jul 21, 2019 at 09:30:10PM -0700, john.hubbard@gmail.com wrote: > for (i = 0; i < vsg->num_pages; ++i) { > if (NULL != (page = vsg->pages[i])) { > if (!PageReserved(page) && (DMA_FROM_DEVICE == vsg->direction)) > - SetPageDirty(page); > - put_page(page); > + put_user_pages_dirty(&page, 1); > + else > + put_user_page(page); > } Can't just pass a dirty argument to put_user_pages? Also do we really need a separate put_user_page for the single page case? put_user_pages_dirty? Also the PageReserved check looks bogus, as I can't see how a reserved page can end up here. So IMHO the above snippled should really look something like this: put_user_pages(vsg->pages[i], vsg->num_pages, vsg->direction == DMA_FROM_DEVICE); in the end.