Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3031704imj; Mon, 11 Feb 2019 12:37:32 -0800 (PST) X-Google-Smtp-Source: AHgI3IYxH3b/t9i1T/kusLKRhiCClLsw3CcJLq4R1o7tWWon2bDFH+12O6Jxe8qRBSEsRNLo8xTn X-Received: by 2002:a63:4706:: with SMTP id u6mr72862pga.95.1549917452713; Mon, 11 Feb 2019 12:37:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549917452; cv=none; d=google.com; s=arc-20160816; b=VE9bmlcsV2WNwRNoiFpBSOtNiTmibtAJMZ8TgvSsFUG2HKfMd261e5uIgO6/W5UNrP EWqkYvPHJGZaEVHkydMlgW+Rt/OtlMo5HWe01U74nBwWZcn69bCrkoCgHnds3Hr5n82T jRmjvmgT5HjPju5yK72FmuhOYWP7hXdsrda31mZ2rMDwGLTaMZdN0ydW/mkwlh7PUQcu z7F88IVsyL1vjs3HaXpKKRsldDUiVqWarwQfwSHU50kYQ/M8pUqXXQJ8M+1T8HeTtevs bcZh2YLydnZgLYXApWM0xvKSVTCLWUoM8ZJnSchI7WzCe2v1AggOib2Zv7qyT7Ltyryz CiPA== 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; bh=uGDmDXix2BtjNrmEsYuBQ0C+tAu5SM9jxBseggRDzDs=; b=ckBZljaOJEpxBCxIqasYYIux0qqkhOaXIZt5zwYzlsaUnx4zJ/8W4RzsF7PRVXRuM/ Sv5b7nAWE0IiQOb5DReuemsq74erXLhcQS0usR7jVDQ7tNEkR/ayUYSQCa1pxDe/lt3A xp7bDGitfNe/bhmytUU9OwrD6qjMrKUYOh+Cfk7Qmj+ZpzNd1+90vNrCCfHxQ0hUZp7A cCHzGYshdLczgKUn757XOCXvRts6e4qgWzocKOH5+3RXZ+5Nti6KJBBGG0Rh9tJ4pv4f XHTMNnUMc9svrKsq5XW2n62bDyVM1hoOSjniE2CkcwmtW2dDG/CIjzhEwv4eRL2jfpa2 rvkA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 187si11318953pfb.41.2019.02.11.12.37.16; Mon, 11 Feb 2019 12:37:32 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732036AbfBKSTe (ORCPT + 99 others); Mon, 11 Feb 2019 13:19:34 -0500 Received: from mga07.intel.com ([134.134.136.100]:4732 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727007AbfBKSTe (ORCPT ); Mon, 11 Feb 2019 13:19:34 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Feb 2019 10:19:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,359,1544515200"; d="scan'208";a="145954222" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by fmsmga001.fm.intel.com with ESMTP; 11 Feb 2019 10:19:33 -0800 Date: Mon, 11 Feb 2019 10:19:22 -0800 From: Ira Weiny To: Jason Gunthorpe Cc: Dan Williams , Jan Kara , Dave Chinner , Christopher Lameter , Doug Ledford , Matthew Wilcox , lsf-pc@lists.linux-foundation.org, linux-rdma , Linux MM , Linux Kernel Mailing List , John Hubbard , Jerome Glisse , Michal Hocko Subject: Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA Message-ID: <20190211181921.GA5526@iweiny-DESK2.sc.intel.com> References: <0c868bc615a60c44d618fb0183fcbe0c418c7c83.camel@redhat.com> <01000168c8e2de6b-9ab820ed-38ad-469c-b210-60fcff8ea81c-000000@email.amazonses.com> <20190208044302.GA20493@dastard> <20190208111028.GD6353@quack2.suse.cz> <20190211102402.GF19029@quack2.suse.cz> <20190211180654.GB24692@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190211180654.GB24692@ziepe.ca> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 11, 2019 at 11:06:54AM -0700, Jason Gunthorpe wrote: > On Mon, Feb 11, 2019 at 09:22:58AM -0800, Dan Williams wrote: > > > I honestly don't like the idea that random subsystems can pin down > > file blocks as a side effect of gup on the result of mmap. Recall that > > it's not just RDMA that wants this guarantee. It seems safer to have > > the file be in an explicit block-allocation-immutable-mode so that the > > fallocate man page can describe this error case. Otherwise how would > > you describe the scenarios under which FALLOC_FL_PUNCH_HOLE fails? > > I rather liked CL's version of this - ftruncate/etc is simply racing > with a parallel pwrite - and it doesn't fail. > > But it also doesnt' trucate/create a hole. Another thread wrote to it > right away and the 'hole' was essentially instantly reallocated. This > is an inherent, pre-existing, race in the ftrucate/etc APIs. I kind of like it as well, except Christopher did not answer my question: What if user space then writes to the end of the file with a regular write? Does that write end up at the point they truncated to or off the end of the mmaped area (old length)? To make this work I think it has to be the later. And as you say the semantic is as if another thread wrote to the file first (but in this case the other thread is the RDMA device). In addition I'm not sure what the overall work is for this case? John's patches will indicate to the FS that the page is gup pinned. But they will not indicate longterm vs not "shorterm". A shortterm pin could be handled as a "real truncate". So, are we back to needing a longterm "bit" in struct page to indicate a longterm pin and allow the FS to perform this "virtual write" after truncate? Or is it safe to consider all gup pinned pages this way? Ira