Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2486974imu; Fri, 14 Dec 2018 11:51:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/UBZjIcxvPfX+Ajrxx75+ddjtqhnIpxzs2fu5oFE8U66PuOXLgDFfws2ylEeyBZq4Xu5HLU X-Received: by 2002:a63:77ce:: with SMTP id s197mr3826894pgc.89.1544817083710; Fri, 14 Dec 2018 11:51:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544817083; cv=none; d=google.com; s=arc-20160816; b=DL9nWJLJDq/ZoFFxIfRH6F0BgJOnKDFP4GehSEDiQRV3EgQ3Y8gHnJgq0UF2xueTCa K6Jh/6ilpzjxla9kWag6ymZVF2+bFb4ZsfftFLawrYVWuoNqtUBoFWLYXVi1ecSvnutk gLijZZmT/EIlOe/Az0/clc4cc1zX2GKrN1SgMa1mwm3YKDPyjK+AxkmNLlgfSwtkZpVw N8FgsxcWQ7vVcAk7o/GjnzZ/usQIBFZ0lUBV+0sVdfJfaEMRPBt7nD5FnDYdndLYK4x5 zyu6fu8/uRvE3+iNXTxAfqZi4rlS1oqeTCCOCt1YK9k3f+VJ0hBIn3Ilw0e0R/QVTC9Z urOg== 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:dkim-signature; bh=GOFeIogLWodk44VJVfXiQHdoFwjtMW1R85VpJJ8G9ls=; b=N1Vo1c53NPdN3uUhFZIW1TyrUtuJLeLKybMQk0Gu/fwGH3pnuAxQ0uV/GcSxFYSDed bb1dpzGxc7yoNmUsJmsqHpHDUVEVAqTWtcGedqGStBCkPxVQFKuRKoQGcBSTIMOJsDKO ssYVJAYd1OOlzZNYWREtLZ8I4We94pabdweT+C2zv+BhfE2E17V3B00HESRGM/PB3vxn 3eSKeHvjDU9KopWfyBw4vE2Q12LezL6P4GgIzsw8mozFN4AjTlfxk70n7YSs4RZC8sUU TwIhh9cUOxoPwEm4kQ5nybqO6FrRtx4HyhwIZji3ommP51Cg/yqni5i/0OmzleyT27Vx wvOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=P0E8pHAE; 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 g3si4890737pgo.595.2018.12.14.11.51.08; Fri, 14 Dec 2018 11:51:23 -0800 (PST) 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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=P0E8pHAE; 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 S1730701AbeLNTsx (ORCPT + 99 others); Fri, 14 Dec 2018 14:48:53 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:52172 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730123AbeLNTsw (ORCPT ); Fri, 14 Dec 2018 14:48:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GOFeIogLWodk44VJVfXiQHdoFwjtMW1R85VpJJ8G9ls=; b=P0E8pHAEFlB29Cy3DD/00io64 gjdyTEJQBGM72v8ID9GWMpKJYsDN0Llk2YstpDtxt+2QLmE3iNcpQS6cVu11BGQtPQz1hQ1jWt52b oUn1bHOv3vZVeQt/0DYRnfb1IqpCt371g+ByJ/P/oGVD1hKnGl3PyJ/oeUou+UVR5ODjB62WLpJFP 86tfkCfYuhV/1CTm2eelQg37cTdBZ83tkbH2C7/FDCM9hba5/7rhcUHEN/fIKUf4aOTI7Xx3rf5DN jd2RcarBPr7QGEFZRoK9TpplKThhgmSHDVjFhIgOs/qENTUAa1Zvb8FDo9QWaaSff0Oa3vhE3yl6P EuDKZvebg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gXtRz-0000ZF-OF; Fri, 14 Dec 2018 19:48:43 +0000 Date: Fri, 14 Dec 2018 11:48:43 -0800 From: Matthew Wilcox To: Dan Williams Cc: John Hubbard , david , =?iso-8859-1?B?Suly9G1l?= Glisse , Jan Kara , John Hubbard , Andrew Morton , Linux MM , tom@talpey.com, Al Viro , benve@cisco.com, Christoph Hellwig , Christopher Lameter , "Dalessandro, Dennis" , Doug Ledford , Jason Gunthorpe , Michal Hocko , Mike Marciniszyn , rcampbell@nvidia.com, Linux Kernel Mailing List , linux-fsdevel , Dave Hansen Subject: Re: [PATCH 1/2] mm: introduce put_user_page*(), placeholder versions Message-ID: <20181214194843.GG10600@bombadil.infradead.org> References: <20181208022445.GA7024@redhat.com> <20181210102846.GC29289@quack2.suse.cz> <20181212150319.GA3432@redhat.com> <20181212214641.GB29416@dastard> <20181212215931.GG5037@redhat.com> <20181213005119.GD29416@dastard> <05a68829-6e6d-b766-11b4-99e1ba4bc87b@nvidia.com> <01cf4e0c-b2d6-225a-3ee9-ef0f7e53684d@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 14, 2018 at 11:38:59AM -0800, Dan Williams wrote: > On Thu, Dec 13, 2018 at 10:11 PM John Hubbard wrote: > > I don't have an answer for that, so maybe the page->mapping idea is dead already. > > > > So in that case, there is still one more way to do all of this, which is to > > combine ZONE_DEVICE, HMM, and gup/dma information in a per-page struct, and get > > there via basically page->private, more or less like this: > > If we're going to allocate something new out-of-line then maybe we > should go even further to allow for a page "proxy" object to front a > real struct page. This idea arose from Dave Hansen as I explained to > him the dax-reflink problem, and dovetails with Dave Chinner's > suggestion earlier in this thread for dax-reflink. > > Have get_user_pages() allocate a proxy object that gets passed around > to drivers. Something like a struct page pointer with bit 0 set. This > would add a conditional branch and pointer chase to many page > operations, like page_to_pfn(), I thought something like it would be > unacceptable a few years ago, but then HMM went and added similar > overhead to put_page() and nobody balked. > > This has the additional benefit of catching cases that might be doing > a get_page() on a get_user_pages() result and should instead switch to > a "ref_user_page()" (opposite of put_user_page()) as the API to take > additional references on a get_user_pages() result. > > page->index and page->mapping could be overridden by similar > attributes in the proxy, and allow an N:1 relationship of proxy > instances to actual pages. Filesystems could generate dynamic proxies > as well. > > The auxiliary information (dev_pagemap, hmm_data, etc...) moves to the > proxy and stops polluting the base struct page which remains the > canonical location for dirty-tracking and dma operations. > > The difficulties are reconciling the source of the proxies as both > get_user_pages() and filesystem may want to be the source of the > allocation. In the get_user_pages_fast() path we may not be able to > ask the filesystem for the proxy, at least not without destroying the > performance expectations of get_user_pages_fast(). I think we can do better than a proxy object with bit 0 set. I'd go for allocating something like this: struct dynamic_page { struct page; unsigned long vaddr; unsigned long pfn; ... }; and use a bit in struct page to indicate that this is a dynamic page.