Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3061807imj; Mon, 11 Feb 2019 13:10:37 -0800 (PST) X-Google-Smtp-Source: AHgI3IaVlmPndNYmBXP6ygVFSfudcO2I6dYKVL6tWFzBOcnemJnMce87dKYL4m589EFiZIiNhogJ X-Received: by 2002:a63:40c1:: with SMTP id n184mr194024pga.225.1549919437542; Mon, 11 Feb 2019 13:10:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549919437; cv=none; d=google.com; s=arc-20160816; b=yqN+UeKh8vSx+9Q0Dx9VLloBuIbUegyS8OBFnOZepYAUUAnjMCsC9CEtq356i6JOh1 z1jvpAq9hq/OuV/63I/0uCSUdNSdDbNBL+zllCqyqEonSaOqhnm80PRtRWQRslulcpJ9 UcDvumRaFTqWeYKbeXHrVTbu7g+Jiwc+WFmSkQLOosBN4LM4gnYXz31cG6mFFRrfAxjt kxcUv4yyuRgvVbOJsda9N3BkL4ZHi3F0M7bsMPi2Tt3MnG8IdY3jg6AI9F2wZZaq4nys HtBI2jbJL632sVWKOLj8xcF1v8ti0Bk6qhvna9v1gsj2Ch/4OASBTbSSDvI0++T2hSI+ Bv4A== 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=jaq4bJN1qOEXyuMZs7wye4duFdAYcvHrSM8nzJ3aR2Y=; b=t7OZNFLM7JmsrJ/ywpOOTzok8TVmKFaqXQhdNcQ5inUbMG2SUJ1IAJG54rQG4P8oVS YnMLgd1OSbBqMxGZT7wPl5tkGYpH2XPCcdnXNBmpw30LwSvnF7TV35B3SLj7F1esSH40 i6Ktv5AhS7jWLQK7UCEJJwwOzzjtYUqev+qH/BcJGdDGI6+Ddjp6cL/GAad5RYxbQf3j Z0eMGdP1VNZiOs16xEalLivup9zkEzHyQJbvVVfnoQ34XAgFkhF8ejKlPsNzk2Pg+wHB sl82AQUTvm9Eqn34izkiLqfVtabSQyjkifENi88u9nw6Ro7YnV4UmgK968o6jUcHzPDB yx8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=UP6aQIvZ; 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 n17si9904978pgv.485.2019.02.11.13.10.15; Mon, 11 Feb 2019 13:10:37 -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=@ziepe.ca header.s=google header.b=UP6aQIvZ; 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 S1727215AbfBKVJ7 (ORCPT + 99 others); Mon, 11 Feb 2019 16:09:59 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35394 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbfBKVJ7 (ORCPT ); Mon, 11 Feb 2019 16:09:59 -0500 Received: by mail-pg1-f195.google.com with SMTP id s198so151145pgs.2 for ; Mon, 11 Feb 2019 13:09:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jaq4bJN1qOEXyuMZs7wye4duFdAYcvHrSM8nzJ3aR2Y=; b=UP6aQIvZmYiway7xzIgJzuIWXK4W48+TLF0JTke857tZ/pIM7SmP1S60I4O5T7XUQs sDVaxnZPHxkGwRokhN95UYV7DGKXLE2zZ2ir7Iy1I5HLwleo9q8B9a60DSARBC8sYAn0 G45Rte8IxbVnsIsRmsxaB318I9Nfo+0ZKLtbweHoP5iev3mbg0SKHmUix5PSP6jdFB/k p9XST+tFajeg3fnQJdzheDATzcj+db/tTvXCyS25fR0oQYq4A17FFHN9ZICkZeGndgmP L2NkVYdD1vGBSwdon1iPwrccgVXz5EEQw/9EdbaVQKjc1oyQdQLKQJPsnqLvnzeHX3bd GcZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jaq4bJN1qOEXyuMZs7wye4duFdAYcvHrSM8nzJ3aR2Y=; b=dZgz3X7x8FSlVphiuhiYrkiKikzN5ScDUqDDNWUcJNlHFW6kRZEYpGRdCIwUvMI04+ Rdh7hIExGYEAQ7b8HRs0+zojQJ9tDvU0jiS5T0P9KAEkUOX2TPQM9IRuqF2/x2Mdxlb9 F80cFKpiBQ38cbjdnxO8JXSFhJhPg/7mmuZ7EbiuBcIn9tsnRCm5yAMGKdd3B6SHC4Zm 5t11LA6pQv0Akp5cY63I6Qd/F8Wexf4cggneiZm9/sp7gcV2YdlCF06ufkFrh8eQlatS hooxW8/ymnQktnr+RKv4uDvtI5LfobkRqizT1/0qjsnDSkl9bj+LVfvqTX+BOFQrN6dT eOAQ== X-Gm-Message-State: AHQUAuaUTs13gc8Cfi/pVJSrJ8U0wVV1lYSw7dooofxH1WZroEtd50Y4 VQ+Tcb3DkxLcba+TL1OLCMU7Eg== X-Received: by 2002:a63:5861:: with SMTP id i33mr257286pgm.60.1549919398236; Mon, 11 Feb 2019 13:09:58 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id u66sm26188695pfi.115.2019.02.11.13.09.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Feb 2019 13:09:57 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1gtIpw-00011F-TG; Mon, 11 Feb 2019 14:09:56 -0700 Date: Mon, 11 Feb 2019 14:09:56 -0700 From: Jason Gunthorpe To: Dan Williams 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 Subject: Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA Message-ID: <20190211210956.GG24692@ziepe.ca> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) 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 01:02:37PM -0800, Dan Williams wrote: > 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. Isn't that already racy? If the mmap user is fast enough can't it prevent the page from becoming freed in the first place today? Jason