From: John Hubbard Subject: Re: [PATCH v3 00/23] mm/gup: track dma-pinned pages: FOLL_PIN, FOLL_LONGTERM Date: Wed, 13 Nov 2019 01:02:02 -0800 Message-ID: <7b671bf9-4d94-f2cc-8453-863acd5a1115@nvidia.com> References: <20191112000700.3455038-1-jhubbard@nvidia.com> <20191112203802.GD5584@ziepe.ca> <02fa935c-3469-b766-b691-5660084b60b9@nvidia.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Daniel Vetter Cc: Jason Gunthorpe , Andrew Morton , Al Viro , Alex Williamson , Benjamin Herrenschmidt , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Christoph Hellwig , Dan Williams , Dave Chinner , David Airlie , "David S . Miller" , Ira Weiny , Jan Kara , Jens Axboe , Jonathan Corbet , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Magnus Karlsson , Mauro Carvalho Chehab , Michael Ellerman List-Id: dri-devel@lists.freedesktop.org On 11/13/19 12:22 AM, Daniel Vetter wrote: ... >>> Why are we doing this? I think things got confused here someplace, as >> >> >> Because: >> >> a) These need put_page() calls, and >> >> b) there is no put_pages() call, but there is a release_pages() call that >> is, arguably, what put_pages() would be. >> >> >>> the comment still says: >>> >>> /** >>> * put_user_page() - release a gup-pinned page >>> * @page: pointer to page to be released >>> * >>> * Pages that were pinned via get_user_pages*() must be released via >>> * either put_user_page(), or one of the put_user_pages*() routines >>> * below. >> >> >> Ohhh, I missed those comments. They need to all be changed over to >> say "pages that were pinned via pin_user_pages*() or >> pin_longterm_pages*() must be released via put_user_page*()." >> >> The get_user_pages*() pages must still be released via put_page. >> >> The churn is due to a fairly significant change in strategy, whis >> is: instead of changing all get_user_pages*() sites to call >> put_user_page(), change selected sites to call pin_user_pages*() or >> pin_longterm_pages*(), plus put_user_page(). > > Can't we call this unpin_user_page then, for some symmetry? Or is that > even more churn? > > Looking from afar the naming here seems really confusing. That look from afar is valuable, because I'm too close to the problem to see how the naming looks. :) unpin_user_page() sounds symmetrical. It's true that it would cause more churn (which is why I started off with a proposal that avoids changing the names of put_user_page*() APIs). But OTOH, the amount of churn is proportional to the change in direction here, and it's really only 10 or 20 lines changed, in the end. So I'm open to changing to that naming. It would be nice to hear what others prefer, too... thanks, -- John Hubbard NVIDIA