Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3055256imj; Mon, 11 Feb 2019 13:03:50 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ/GMBszmtaKopauAmPoq8pf6qbU1ZPg0MY/IdPHIJxlMn5MAi8mRhv5hdcpHVn1rMvQGVW X-Received: by 2002:a17:902:a417:: with SMTP id p23mr190270plq.187.1549919030535; Mon, 11 Feb 2019 13:03:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549919030; cv=none; d=google.com; s=arc-20160816; b=GGUacYvInbalEwI2K2BdCJ1vA1yEVCSmBg9m9GiKQBK+mzIJYrxOB/v0C3R+f80Kgi 9/z2mz7keq61maZ4XGtGvUXOwhnmk0icNVFn+x/78ZDJvrXfYmCy4p/ScxmxjeHtSfz2 4d/h6TSsIH8vUQpPzwomr/3WX2fTH0aQxi5OX/CRY9BJeOg1ZUSvswhEYQppmbw9zIQm iJiutau0mmS5sYUcZC7zdtXpI1whwTKkHvhoXS/ACIqDnfWEqb8cMlXxKUoBokgNKLmD /3pv8G70e7zkzX8ATKePLEpgdR6U5PQMRTAhMS1i8fMC9nYYDIwiZCxIdAXXyFLML6jI GW7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ue3vXSU/Uyn4dHhRrNll0Xk0Xsd0Oc1wTjLcVxg/RVU=; b=VLKIYXfFDR8InBWChvNd2ypOzgsAt4azqRoND0BEiczdIczL3crrt2HyPcp9xOQpCk 0bGtGYHDYFqUujsAI3VlmEmopqGg1VbeyW2vftKw6NCS5nPsbgvh/MKpHDLc5Z3qMI8Q TT/kD4WIgRQq5m2tzlL3kJm6HY4epaoopiOCFQXfAHcuY9dgmJMf8F+TsVpAxC2P6zsE 2hgU2Cx8uIKLr9hdIuPpZDich2lRMqkCjqZ8z6okL5kOgcRdG+8uqGEQuVCf2hYa7HEe dUn3UWINM4uNpmE8pGyqg7d1uoGL/wDldTmJH3c234H7aEx7wwt7V0iendQ4kfloehrp rUUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=hUIoym1j; 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 k16si5182302pls.124.2019.02.11.13.03.34; Mon, 11 Feb 2019 13:03:50 -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=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=hUIoym1j; 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 S1727061AbfBKVCu (ORCPT + 99 others); Mon, 11 Feb 2019 16:02:50 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:33449 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbfBKVCt (ORCPT ); Mon, 11 Feb 2019 16:02:49 -0500 Received: by mail-ot1-f66.google.com with SMTP id i20so672537otl.0 for ; Mon, 11 Feb 2019 13:02:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ue3vXSU/Uyn4dHhRrNll0Xk0Xsd0Oc1wTjLcVxg/RVU=; b=hUIoym1jWomz+hQ3cjra7vbu8N5t4Hnlg+PAqHz9/FbJkw5AbL1Sv33KOuBzmBGiuw XFTkiY3/ijZ6462k6DJrU7QYA9Vd5lttHeHLC0g1iQcLlLS7j/vcZPHVAConzOdMRrvy n2QpK6+M5qBuH4QcCR04be/KEWKPeslapu3m3t0isgfrskGI8tLy1kqohwuqEFTvJPE3 X1sCVWaUU0De1pZLAqvjBRCwaa7k+YeoI3EnJv4AYoa5NNEY1d7gCQSUmQsO2WEgstLP ac5rNKg/bs0GU3zUFz0Eq9XUOeFF4D8Di2ts/s5d0y6iESwJXdZbWcfvbwU4Nt0K7Oin LCmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ue3vXSU/Uyn4dHhRrNll0Xk0Xsd0Oc1wTjLcVxg/RVU=; b=buoVHzb4MwfonOXT2XLd1wFjPDWpUG/A44BP0e/9YkgqPUSsMjcE0l5n7rbPyQyuAk aOxuz3Mvs3OEixLiDe9YxfEgwT3bOUENS1JXkmDmeyYG8Sw3BEDjhNaReqyQj+bSQjUc f/UTYtUyZFWGeFkMFb1M5hAgdor+tCSYZLYw0LtNBGqKraVbukdsoe1qZwTXNtfAEwDm Z9s70tvSf4zYb6ewoai54/i8G6nNJEGbBc0W9uxn+kJEKas3N7opURTwMy85GKj7byKJ LqBqrohItGi9rQ2jr/+9EloYNnFfnvwOIlxHPFVQVM6tg0iGi9LvQjeqqB6ekd75Vnph eq2g== X-Gm-Message-State: AHQUAuburxX6v5OAkipWt9NKHSF5bDEequ6Aiz3mhQRLCPvDlpZooBq6 sSkVvZxZVqgmd0SrSUxWY9dhTgwaqqWl+rbxYGBdag== X-Received: by 2002:a9d:6a50:: with SMTP id h16mr169743otn.95.1549918968592; Mon, 11 Feb 2019 13:02:48 -0800 (PST) MIME-Version: 1.0 References: <20190208044302.GA20493@dastard> <20190208111028.GD6353@quack2.suse.cz> <20190211102402.GF19029@quack2.suse.cz> <20190211180654.GB24692@ziepe.ca> <20190211181921.GA5526@iweiny-DESK2.sc.intel.com> <20190211182649.GD24692@ziepe.ca> <20190211184040.GF12668@bombadil.infradead.org> <20190211204945.GF24692@ziepe.ca> In-Reply-To: <20190211204945.GF24692@ziepe.ca> From: Dan Williams Date: Mon, 11 Feb 2019 13:02:37 -0800 Message-ID: Subject: Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA To: Jason Gunthorpe Cc: Matthew Wilcox , Ira Weiny , Jan Kara , Dave Chinner , Christopher Lameter , Doug Ledford , lsf-pc@lists.linux-foundation.org, linux-rdma , Linux MM , Linux Kernel Mailing List , John Hubbard , Jerome Glisse , Michal Hocko Content-Type: text/plain; charset="UTF-8" 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 12:49 PM Jason Gunthorpe wrote: > > On Mon, Feb 11, 2019 at 11:58:47AM -0800, Dan Williams wrote: > > On Mon, Feb 11, 2019 at 10:40 AM Matthew Wilcox wrote: > > > > > > On Mon, Feb 11, 2019 at 11:26:49AM -0700, Jason Gunthorpe wrote: > > > > On Mon, Feb 11, 2019 at 10:19:22AM -0800, Ira Weiny wrote: > > > > > 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)? > > > > > > > > IIRC it depends how the user does the write.. > > > > > > > > pwrite() with a given offset will write to that offset, re-extending > > > > the file if needed > > > > > > > > A file opened with O_APPEND and a write done with write() should > > > > append to the new end > > > > > > > > A normal file with a normal write should write to the FD's current > > > > seek pointer. > > > > > > > > I'm not sure what happens if you write via mmap/msync. > > > > > > > > RDMA is similar to pwrite() and mmap. > > > > > > A pertinent point that you didn't mention is that ftruncate() does not change > > > the file offset. So there's no user-visible change in behaviour. > > > > ...but there is. The blocks you thought you freed, especially if the > > system was under -ENOSPC pressure, won't actually be free after the > > successful ftruncate(). > > They won't be free after something dirties the existing mmap either. > > Blocks also won't be free if you unlink a file that is currently still > open. > > This isn't really new behavior for a FS. An mmap write after a fault due to a hole punch is free to trigger SIGBUS if the subsequent page allocation fails. So no, I don't see them as the same unless you're allowing for the holder of the MR to receive a re-fault failure.