From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Hubbard Subject: Re: [PATCH 1/3] drivers/gpu/drm/via: convert put_page() to put_user_page*() Date: Mon, 22 Jul 2019 12:10:59 -0700 Message-ID: <14ac5f41-c27e-c5a7-e16a-4bd3cec0d31f@nvidia.com> References: <20190722043012.22945-1-jhubbard@nvidia.com> <20190722043012.22945-2-jhubbard@nvidia.com> <20190722093355.GB29538@lst.de> <397ff3e4-e857-037a-1aee-ff6242e024b2@nvidia.com> <20190722190722.GF363@bombadil.infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190722190722.GF363@bombadil.infradead.org> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Matthew Wilcox Cc: Christoph Hellwig , john.hubbard@gmail.com, Andrew Morton , Alexander Viro , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Boaz Harrosh , Daniel Vetter , Dan Williams , Dave Chinner , David Airlie , "David S . Miller" , Ilya Dryomov , Jan Kara , Jason Gunthorpe , Jens Axboe , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Johannes Thumshirn , Magnus Karlsson , Miklos Szeredi , Ming Lei , Sage Weil List-Id: dri-devel@lists.freedesktop.org On 7/22/19 12:07 PM, Matthew Wilcox wrote: > On Mon, Jul 22, 2019 at 11:53:54AM -0700, John Hubbard wrote: >> On 7/22/19 2:33 AM, Christoph Hellwig wrote: >>> 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 >> >> Yes, and in fact that would help a lot more than the single page case, >> which is really just cosmetic after all. >> >>> need a separate put_user_page for the single page case? >>> put_user_pages_dirty? >> >> Not really. I'm still zeroing in on the ideal API for all these call sites, >> and I agree that the approach below is cleaner. > > so enum { CLEAN = 0, DIRTY = 1, LOCK = 2, DIRTY_LOCK = 3 }; > ? > Sure. In fact, I just applied something similar to bio_release_pages() locally, in order to reconcile Christoph's and Jerome's approaches (they each needed to add a bool arg), so I'm all about the enums in the arg lists. :) I'm going to post that one shortly, let's see how it goes over. heh. thanks, -- John Hubbard NVIDIA