Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2258229imm; Thu, 21 Jun 2018 09:31:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLBAYqP0HZIWcQshJEnN7lb+BBvztuWx7idwsMrA7WSP7DbSvJ0eltdHXooo2neqlIpXm6W X-Received: by 2002:a17:902:b40f:: with SMTP id x15-v6mr29555600plr.270.1529598707990; Thu, 21 Jun 2018 09:31:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529598707; cv=none; d=google.com; s=arc-20160816; b=r7aKJyS+DbGlDleYLvCFmA2WGGlJzzVnEGhFI2qIqtISqFalb57ZNsiIUHSr0jwUh9 gPVBU9Nw8PvjfJlOE+0Mc5KKzmy9UWHsWgvC1CjCRsu1MOqGsfjYUC1meSUM1tK6xi9u hWoAL6Zz+s5ALQsWsBCtlULo24UJyTDcooxbi3j47P6uMWTRTlEWrNKcTBTyr2QxIY73 N+nypkOZg57LtS4SfiP2f22UojBo9uHfdqSL22Td4Lok7sjMsm5QZsfkeD09dxapo8iN InxDKnEi3v3VzggsLPKi0xDtjjfKKjrfQMUAqZmQhagIDPtsHSWdQGzNRmn7BtB/hCKa dvng== 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=lJ3N6rAB0qdjRHJGyIY5lHgxXqyOJPHfhDNZQqftrSQ=; b=xNhE+djbslLhJYkOvqbjo5SUv3CeL86X3B1w24TpumimfR6fICZCxjbT+mWBT0doek hXs6lsF26Nac40EatWS3BjkJ/+YPTIiMwn7YYiOh4b72mcreooqSIjWjmeFLny28MsdJ NIPWnFf1vfY+4bl3moLZ9s8brfHVQ5NKtN+BPQUouO0NtPB6IIW9JEbXGwwwlBnuuzwO 0K77lNA2doHNPZFdrM6VYJFDjt/hUC6vjQrsDbl6bVQkI0FTG0tdKphBUBPocK+r2T8z EhMQ4VKGhj56Yy14ggqfxY5AlGHgTSt3GruT7Km81L0So3Qfnc/jKDvm9cUoZ8UNJ/Sf E/5w== 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 g12-v6si4314675pgq.166.2018.06.21.09.31.32; Thu, 21 Jun 2018 09:31:47 -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 S933470AbeFUQao (ORCPT + 99 others); Thu, 21 Jun 2018 12:30:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:47100 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933297AbeFUQam (ORCPT ); Thu, 21 Jun 2018 12:30:42 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E87C1ACFA; Thu, 21 Jun 2018 16:30:37 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 159351E325D; Thu, 21 Jun 2018 18:30:36 +0200 (CEST) Date: Thu, 21 Jun 2018 18:30:36 +0200 From: Jan Kara To: John Hubbard Cc: Jan Kara , Matthew Wilcox , Dan Williams , Christoph Hellwig , Jason Gunthorpe , John Hubbard , Michal Hocko , Christopher Lameter , Linux MM , LKML , linux-rdma Subject: Re: [PATCH 2/2] mm: set PG_dma_pinned on get_user_pages*() Message-ID: <20180621163036.jvdbsv3t2lu34pdl@quack2.suse.cz> References: <3898ef6b-2fa0-e852-a9ac-d904b47320d5@nvidia.com> <0e6053b3-b78c-c8be-4fab-e8555810c732@nvidia.com> <20180619082949.wzoe42wpxsahuitu@quack2.suse.cz> <20180619090255.GA25522@bombadil.infradead.org> <20180619104142.lpilc6esz7w3a54i@quack2.suse.cz> <70001987-3938-d33e-11e0-de5b19ca3bdf@nvidia.com> <20180620120824.bghoklv7qu2z5wgy@quack2.suse.cz> <151edbf3-66ff-df0c-c1cc-5998de50111e@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <151edbf3-66ff-df0c-c1cc-5998de50111e@nvidia.com> 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 Wed 20-06-18 15:55:41, John Hubbard wrote: > On 06/20/2018 05:08 AM, Jan Kara wrote: > > On Tue 19-06-18 11:11:48, John Hubbard wrote: > >> On 06/19/2018 03:41 AM, Jan Kara wrote: > >>> On Tue 19-06-18 02:02:55, Matthew Wilcox wrote: > >>>> On Tue, Jun 19, 2018 at 10:29:49AM +0200, Jan Kara wrote: > [...] > >>> I'm also still pondering the idea of inserting a "virtual" VMA into vma > >>> interval tree in the inode - as the GUP references are IMHO closest to an > >>> mlocked mapping - and that would achieve all the functionality we need as > >>> well. I just didn't have time to experiment with it. > >> > >> How would this work? Would it have the same virtual address range? And how > >> does it avoid the problems we've been discussing? Sorry to be a bit slow > >> here. :) > > > > The range covered by the virtual mapping would be the one sent to > > get_user_pages() to get page references. And then we would need to teach > > page_mkclean() to check for these virtual VMAs and block / skip / report > > (different situations would need different behavior) such page. But this > > second part is the same regardless how we identify a page that is pinned by > > get_user_pages(). > > > OK. That neatly avoids the need a new page flag, I think. But of course it is > somewhat more extensive to implement. Sounds like something to keep in mind, > in case it has better tradeoffs than the direction I'm heading so far. Yes, the changes needed are somewhat more intrusive. I'm looking into this approach now to see how the result will look like... Honza -- Jan Kara SUSE Labs, CR