From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Williams Subject: Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA Date: Mon, 11 Feb 2019 11:58:47 -0800 Message-ID: References: <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> <20190211181921.GA5526@iweiny-DESK2.sc.intel.com> <20190211182649.GD24692@ziepe.ca> <20190211184040.GF12668@bombadil.infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: <20190211184040.GF12668@bombadil.infradead.org> Sender: linux-kernel-owner@vger.kernel.org To: Matthew Wilcox Cc: Jason Gunthorpe , 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 List-Id: linux-rdma@vger.kernel.org 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().