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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham 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 3F4A7C282CB for ; Tue, 5 Feb 2019 11:21:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 129132070B for ; Tue, 5 Feb 2019 11:21:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727916AbfBELVP (ORCPT ); Tue, 5 Feb 2019 06:21:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:33210 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726956AbfBELVP (ORCPT ); Tue, 5 Feb 2019 06:21:15 -0500 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 2D58BAA5C; Tue, 5 Feb 2019 11:21:14 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 2DC0E1E3FED; Tue, 5 Feb 2019 12:21:07 +0100 (CET) Date: Tue, 5 Feb 2019 12:21:07 +0100 From: Jan Kara To: John Hubbard Cc: Jan Kara , lsf-pc@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Dan Williams , Jerome Glisse Subject: Re: [LSF/MM TOPIC] get_user_pages() pins in file mappings Message-ID: <20190205112107.GB3872@quack2.suse.cz> References: <20190124090400.GE12184@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Hi John, On Mon 04-02-19 15:46:10, John Hubbard wrote: > On 1/24/19 1:04 AM, Jan Kara wrote: > > > In particular we hope to have reasonably robust mechanism of identifying > > pages pinned by GUP (patches will be posted soon) - I'd like to run that by > > MM folks (unless discussion happens on mailing lists before LSF/MM). We > > also have ideas how filesystems should react to pinned page in their > > writepages methods - there will be some changes needed in some filesystems > > to bounce the page if they need stable page contents. So I'd like to > > explain why we chose to do bouncing to fs people (i.e., why we cannot just > > wait, skip the page, do something else etc.) to save us from the same > > discussion with each fs separately and also hash out what the API for > > filesystems to do this should look like. Finally we plan to keep pinned > > page permanently dirty - again something I'd like to explain why we do this > > and gather input from other people. > > Hi Jan, > > Say, I was just talking through this point with someone on our driver team, > and suddenly realized that I'm now slightly confused on one point. If we end > up keeping the gup-pinned pages effectively permanently dirty while pinned, > then maybe the call sites no longer need to specify "dirty" (or not) when > they call put_user_page*()? > > In other words, the RFC [1] has this API: > > void put_user_page(struct page *page); > void put_user_pages_dirty(struct page **pages, unsigned long npages); > void put_user_pages_dirty_lock(struct page **pages, unsigned long npages); > void put_user_pages(struct page **pages, unsigned long npages); > > But maybe we only really need this: > > void put_user_page(struct page *page); > void put_user_pages(struct page **pages, unsigned long npages); > > ? > > [1] https://lkml.kernel.org/r/20190204052135.25784-1-jhubbard@nvidia.com So you are right that if we keep gup-pinned pages dirty, drivers could get away without marking them as such. However I view "keep pages dirty" as an implementation detail, rather than a promise of the API. So I'd like to leave us the flexibility of choosing a different implementation in the future. And as such I'd just leave the put_user_pages_dirty() variants in place. Honza -- Jan Kara SUSE Labs, CR