Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp711134imm; Mon, 9 Jul 2018 09:14:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe99T4ScTaE8oRR/ozikgiAC/PXzfCopJLgKxiiAXvbiU9SF+Ncaml6yqrekenLGerpHo/W X-Received: by 2002:a17:902:88:: with SMTP id a8-v6mr20750072pla.156.1531152873295; Mon, 09 Jul 2018 09:14:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531152873; cv=none; d=google.com; s=arc-20160816; b=QacAGckQwa7awQD9i9vEbVvCYHcH/1I523Zv2O9579cXbKqbQYIxkHYTybQmpe/XWB ypL4Jy3AR1HenXy8sjQbDahVRsT3uVlSZ2C62l/9xudBKMFNfqsHR7jWPSjuS+Umvr8z MNQn7ROO8Txr9yURs2fY19OwSSRMEHAYkmAJy6gl7+ycOxby0IvnABsfAjW7DzPU42WN pwPpMViBl6GQGtCwjaBNhBdFol+IdMJKU0Gy0YHIXKfclZIDV0/CvN/YNdi/tFET40Qr P0nEHWJt+EUGui+wNYNn2xAn2IHphdlnS1rfXFsMXoHIESwD8nu+PsNSdPZ5wkA0o2mz M9Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=hMbR3GT1DtsLia44Bf3v+Q2PiLvAD/Vc+aEkMSAvi6s=; b=BuCCCRx4m3EAHDmryrtQweUmzIszHoZt/3GJ9Ep2ZVL1MTtW+3AimpGOP36rKxSu4f DUo9Ym4cOqFh/w9B8aGcylfinQEQWzQ6nhT/kj859viVf4JdWyt6PLl/bMKPWNX+2zDT YDoELRAWIK0dE6HqsnEHZ8U2+WL3Y1iod6JorUp+LbAH02SKyHF2MOk7zdDOH/LM4hcF az5WWXK2znGTdF0MPx8pKMk/CdmgSwdC5aTixKH4z2+NEvxnRX7L/M9nhxgB/AbXsYoA LPMv3G7hIdyVDZTtUiMrMkXxoUFF/JHSpOXu7gtnO0cUFr74gf8a+KTDuBHXLzgWs9dI kS5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i28-v6si2737633pfi.105.2018.07.09.09.14.18; Mon, 09 Jul 2018 09:14:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754583AbeGIQL5 (ORCPT + 99 others); Mon, 9 Jul 2018 12:11:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:51788 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754556AbeGIQL4 (ORCPT ); Mon, 9 Jul 2018 12:11: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 A6093AC8A; Mon, 9 Jul 2018 16:11:54 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 32E431E0DD5; Mon, 9 Jul 2018 18:11:54 +0200 (CEST) Date: Mon, 9 Jul 2018 18:11:54 +0200 From: Jan Kara To: Jason Gunthorpe Cc: john.hubbard@gmail.com, Matthew Wilcox , Michal Hocko , Christopher Lameter , Dan Williams , Jan Kara , Al Viro , linux-mm@kvack.org, LKML , linux-rdma , linux-fsdevel@vger.kernel.org, John Hubbard Subject: Re: [PATCH 1/2] mm: introduce put_user_page(), placeholder version Message-ID: <20180709161154.46chzohwnzzbrtis@quack2.suse.cz> References: <20180709080554.21931-1-jhubbard@nvidia.com> <20180709080554.21931-2-jhubbard@nvidia.com> <20180709155357.GA13496@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180709155357.GA13496@ziepe.ca> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 09-07-18 09:53:57, Jason Gunthorpe wrote: > On Mon, Jul 09, 2018 at 01:05:53AM -0700, john.hubbard@gmail.com wrote: > > From: John Hubbard > > > > Introduces put_user_page(), which simply calls put_page(). > > This provides a safe way to update all get_user_pages*() callers, > > so that they call put_user_page(), instead of put_page(). > > > > Also adds release_user_pages(), a drop-in replacement for > > release_pages(). This is intended to be easily grep-able, > > for later performance improvements, since release_user_pages > > is not batched like release_pages is, and is significantly > > slower. > > > > Subsequent patches will add functionality to put_user_page(). > > > > Signed-off-by: John Hubbard > > include/linux/mm.h | 14 ++++++++++++++ > > 1 file changed, 14 insertions(+) > > > > diff --git a/include/linux/mm.h b/include/linux/mm.h > > index a0fbb9ffe380..db4a211aad79 100644 > > +++ b/include/linux/mm.h > > @@ -923,6 +923,20 @@ static inline void put_page(struct page *page) > > __put_page(page); > > } > > > > +/* Placeholder version, until all get_user_pages*() callers are updated. */ > > +static inline void put_user_page(struct page *page) > > +{ > > + put_page(page); > > +} > > + > > +/* A drop-in replacement for release_pages(): */ > > +static inline void release_user_pages(struct page **pages, > > + unsigned long npages) > > +{ > > + while (npages) > > + put_user_page(pages[--npages]); > > +} > > + > > #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) > > #define SECTION_IN_PAGE_FLAGS > > #endif > > Just as question: Do you think it is worthwhile to have a > release_user_page_dirtied() helper as well? > > Ie to indicate that a pages that were grabbed under GUP FOLL_WRITE > were actually written too? > > Keeps more of these unimportant details out of the drivers.. Yeah, I think that would be nice as well. Honza -- Jan Kara SUSE Labs, CR