Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1012302imu; Thu, 13 Dec 2018 08:04:05 -0800 (PST) X-Google-Smtp-Source: AFSGD/UbcsAW9QJPfVk6OX63Pc9V4uCm4YtemdXy7I/63VYyONFxrrc67PK58XjyQYJvgvb7uVcY X-Received: by 2002:a63:6d0e:: with SMTP id i14mr1432967pgc.215.1544717044973; Thu, 13 Dec 2018 08:04:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544717044; cv=none; d=google.com; s=arc-20160816; b=oSMNXnKhtt5+IUx3cuRGyi7VEg6XdFbL37kgqbsOdXYxediIuG1wQE6uBQoQL31MQ1 XxgnCJNzvigB68Zy4bEl/aFTJzhk+hOk38x+VDsXBTVPzVcRc2m2EKFWYz1nhpuW7qiX rGCnDaq/Sy15RrJNLvLk/ZbKow9qSYxVy5ADOsTnQ3ON+aCs8sfQqvj+6W2yOV4MJEqo sEYAzNJzh6JXWjPwjNf+YxmESCZcQdOKBOHSAZ7gu1imEFs3B8zRe5IxfdBSquo90q2Z mU3bzLUZbRh5ic0eURXdm8J7goOIg40jDwCoF4Dgf4l8CcO3r0bxO0jh8fqC1iUuBe1D MLTg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=wA2v8YZn/E5mjRxUyOdS1gyt7gdRwEeBl9kYQa+jdUU=; b=fRKpE0XhZ8hil43McKNE1DOtv0Bz5pnzemLgzH+0CTGuP8QC0/VmPHbu7EzfGD60aI kwJrR0uIYVQjsJY7Cc+Tudo8mNsx6N+npYC04LI/2XpH5DDQP0zXty3h2bkkqurysWgR 70oNMXkucgBmJQfJgK25sRi6EUVPP1gPUuY41XAKQWHcuN5bDHlGgI/VuiDwMxdtxYi2 vOF15D03G9PUEgMa28kQDL3ssCSTIfAHL90kUVCQXXtgskl2agNTtP8sDTf/CeL0DMj5 u+8fusceboE50lsZNpS5mYyuLc7uo0siA4qlh22g1+6hEjUu31vlBM/fUUoSNT/jTu+r Sdsw== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g26si1713672pfi.184.2018.12.13.08.03.36; Thu, 13 Dec 2018 08:04:04 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729176AbeLMQCJ (ORCPT + 99 others); Thu, 13 Dec 2018 11:02:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56086 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727942AbeLMQCJ (ORCPT ); Thu, 13 Dec 2018 11:02:09 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EDF0DC058CB1; Thu, 13 Dec 2018 16:02:07 +0000 (UTC) Received: from redhat.com (ovpn-121-185.rdu2.redhat.com [10.10.121.185]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 70DA7648AB; Thu, 13 Dec 2018 16:02:05 +0000 (UTC) Date: Thu, 13 Dec 2018 11:02:03 -0500 From: Jerome Glisse To: Christopher Lameter Cc: Dave Chinner , Jan Kara , John Hubbard , Matthew Wilcox , Dan Williams , John Hubbard , Andrew Morton , Linux MM , tom@talpey.com, Al Viro , benve@cisco.com, Christoph Hellwig , "Dalessandro, Dennis" , Doug Ledford , Jason Gunthorpe , Michal Hocko , mike.marciniszyn@intel.com, rcampbell@nvidia.com, Linux Kernel Mailing List , linux-fsdevel Subject: Re: [PATCH 1/2] mm: introduce put_user_page*(), placeholder versions Message-ID: <20181213160203.GD3186@redhat.com> References: <20181207191620.GD3293@redhat.com> <3c4d46c0-aced-f96f-1bf3-725d02f11b60@nvidia.com> <20181208022445.GA7024@redhat.com> <20181210102846.GC29289@quack2.suse.cz> <20181212150319.GA3432@redhat.com> <20181212214641.GB29416@dastard> <20181212215931.GG5037@redhat.com> <20181213005119.GD29416@dastard> <20181213020229.GN5037@redhat.com> <01000167a8483bd2-16ae0d3e-d217-4993-a80a-25d221c677e4-000000@email.amazonses.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <01000167a8483bd2-16ae0d3e-d217-4993-a80a-25d221c677e4-000000@email.amazonses.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 13 Dec 2018 16:02:08 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 13, 2018 at 03:56:05PM +0000, Christopher Lameter wrote: > On Wed, 12 Dec 2018, Jerome Glisse wrote: > > > On Thu, Dec 13, 2018 at 11:51:19AM +1100, Dave Chinner wrote: > > > > > > [O1] Avoid write back from a page still being written by either a > > > > > > device or some direct I/O or any other existing user of GUP. > > > > > > IOWs, you need to mark pages being written to by a GUP as > > > PageWriteback, so all attempts to write the page will block on > > > wait_on_page_writeback() before trying to write the dirty page. > > > > No you don't and you can't for the simple reasons is that the GUP > > of some device driver can last days, weeks, months, years ... so > > it is not something you want to do. Here is what happens today: > > I think it would be better to use the established way to block access that > Dave suggests. Maybe deal with the issue of threads being blocked for > a long time instead? Introduce a way to abort these attempts in a > controlled fashion that also allows easy debugging of these conflicts? GUP does not have the information on how long the GUP will last, the GUP caller might not know either. What is worse is that the GUP user provide API today to userspace to do this and thus any attempt to block this from happening can be interpreted (from some point of view) as a regression ie worked in linux X.Y does not work in linux X.Y+1. I am not against doing that, in fact i advocated at last LSF that any user of GUP that does not abide to mmu notifier should be denied GUP (direct IO, kvm and couple other like that being the exception because they are case we can properly fix). Anyone that abide to mmu notifier will drop the page reference on any event like truncate, split, mremap, munmap, write back ... so anyone with mmu notifier is fine. Cheers, J?r?me