Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp909335imm; Mon, 9 Jul 2018 13:01:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc/TM90fCVml534ZkCy6uo2tnSXuoM8du3ofIyiPpsbUqLk4IXa8VXFnajcGT2ddFiwo6p8 X-Received: by 2002:a17:902:9a4b:: with SMTP id x11-v6mr21534909plv.342.1531166514631; Mon, 09 Jul 2018 13:01:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531166514; cv=none; d=google.com; s=arc-20160816; b=ZgkrkOhzksnSCQpCoL/Uz22BJC7rsbBgKXxgMNHPjMqaw/ZcR35agTWm7Or+5B7lbK bUzdkzeNI3ErQEYTFb+e6aktCgOSFKGk9fAuzj2RBa+mD8wIwACf4nyNdkPgXbQT17Ny Xan4WgkMN0ET5D5FitNHdkSckbkAuyuHaw8P0ybPfrcuIoScDhBQgB1WvCfsLPkyCUmP nm0+ag30hBsS/wf1SRSB/mPuRH8ODrnMh1UD8wFN9bAPL8pAM9Oc3jQTOvGEAEZzi8YI qOFP46ujC0k+GMfPnpjY8xx9mDDikrQee8SfUeaeCMESVvLD8wemXItpeuHc7V/z6KB4 ofhw== 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:arc-authentication-results; bh=vMGm/wys4BkcUB4zf6/saQQAfQ+jl/qW3WA0bhwA02k=; b=WihvpwrHcpeN/hcvxDMc0tC/OVf1KB95aFEI+9Vh/WIRsTGhjYmthn2qhuslUIRvKx nXqEB811D7yAnC4EWY6SHT4VPT38EM8gwDwRZ8goAbDA+DPppsrYLHj171tBEgiRVMvl iDIYsVKVH/GM4COiiGjSmVbOnnmc3YN2l7d3e51K8+3KeJteEFfajBjylkygZ2Czb9bV bYNO/Yn0t8Q0IuGZROg8+x7dyulGADD8YXOqENxfhtWBGTZKwvSsEr3yGshFSRnCG5gN g2nQIWDYdjJ65g+Ru1Dt1v2Nq9k/4LvicRn+DnVXyUFUAj2s/xPTB3kJnN/LNzC2n8tu oprg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="rtZ/X/j4"; 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 6-v6si15627754plb.409.2018.07.09.13.01.39; Mon, 09 Jul 2018 13:01:54 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="rtZ/X/j4"; 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 S933027AbeGIUA7 (ORCPT + 99 others); Mon, 9 Jul 2018 16:00:59 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34824 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932764AbeGIUA5 (ORCPT ); Mon, 9 Jul 2018 16:00:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=vMGm/wys4BkcUB4zf6/saQQAfQ+jl/qW3WA0bhwA02k=; b=rtZ/X/j4j0f8vXbKDNfrgn+rE Hh2NwiTFDkleHPKK9/XotoE7Y/iyBx4AGeojlbo9EZY39/ynKjXbzUeR5nRiQUcGFNRyAa9e6HXlW Fz9eiTc6czY+s5o+usp/1A5MeG/OfIce7nDxBlLpEjMUZtk1pt6EKe5fQyrkzhgZNFJ4RaXNyodvv 2yXeHJ0PDjZKjr8mbKx5TSrHAH+69kmSR4JF8gN5RKCqZNgmrphwTSl/lgi8qcVLoWOD9y1gtY1Yd cCnkXXEU0HfYvgjdahd9F9vdikWvyr78D8cq2PYVjBZ9KtvTkM/RIik552jrIaGmjN2Myt29LiIlP 2oB6L/nZA==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fccL3-0006BS-T5; Mon, 09 Jul 2018 20:00:49 +0000 Date: Mon, 9 Jul 2018 13:00:49 -0700 From: Matthew Wilcox To: Jan Kara Cc: Nicholas Piggin , john.hubbard@gmail.com, Michal Hocko , Christopher Lameter , Jason Gunthorpe , Dan Williams , Al Viro , linux-mm@kvack.org, LKML , linux-rdma , linux-fsdevel@vger.kernel.org, John Hubbard Subject: Re: [PATCH 0/2] mm/fs: put_user_page() proposal Message-ID: <20180709200049.GA5335@bombadil.infradead.org> References: <20180709080554.21931-1-jhubbard@nvidia.com> <20180709184937.7a70c3aa@roar.ozlabs.ibm.com> <20180709160806.xjt2l2pbmyiutbyi@quack2.suse.cz> <20180709171651.GE2662@bombadil.infradead.org> <20180709194740.rymbt2fzohbdmpye@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180709194740.rymbt2fzohbdmpye@quack2.suse.cz> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 09, 2018 at 09:47:40PM +0200, Jan Kara wrote: > On Mon 09-07-18 10:16:51, Matthew Wilcox wrote: > > > 2) What to do when some page is pinned but we need to do e.g. > > > clear_page_dirty_for_io(). After some more thinking I agree with you that > > > just blocking waiting for page to unpin will create deadlocks like: > > > > Why are we trying to writeback a page that is pinned? It's presumed to > > be continuously redirtied by its pinner. We can't evict it. > > So what should be a result of fsync(file), where some 'file' pages are > pinned e.g. by running direct IO? If we just skip those pages, we'll lie to > userspace that data was committed while it was not (and it's not only about > data that has landed in those pages via DMA, you can have first 1k of a page > modified by normal IO in parallel to DMA modifying second 1k chunk). If > fsync(2) returns error, it would be really unexpected by userspace and most > apps will just not handle that correctly. So what else can you do than > block? I was thinking about writeback, and neglected the fsync case. For fsync, we could copy the "current" contents of the page to a freshly-allocated page and write _that_ to disc? As long as we redirty the real page after the pin is dropped, I think we're fine.