Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2532048pxk; Mon, 14 Sep 2020 16:32:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhi07xfNBkFi0i4SA7OYmIZLBu6G/0NnTk2F90TKAMQL6rfU/Fdz7MF5ebeXZovkNSCVUE X-Received: by 2002:a17:906:4154:: with SMTP id l20mr18265249ejk.68.1600126328576; Mon, 14 Sep 2020 16:32:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600126328; cv=none; d=google.com; s=arc-20160816; b=0HnGiAuAlAC1f2zwxtc7zvRCzW1Ld9i5KoeFlTbU/Dokxe4BUwPZ7ZPcHGzWdHeuOG TqcsVB6vFZAM5WCBZ19YCTp2kBdCyF7mN0sYEW5+4JSdu3t+ps/2r2piO6NXIa15oksa So14WAvpar/5uoqrrhI3B5N9PwxsL9z9t5UyGbkkTihrMDUIx3dQX1wAXKO17Dp0w5Tn m9tBjlnyB/tlLMT4GqKuhC7Qi+R2svHZssNW9hAK56KzUWnh2hrXKEG97CY4lERLIuRL r6Lr+3mHqHETMfCbVoYNr/ygM9DEvOg7WovO09zkxdEwj0ny2GRC2XBpQH5LtIXK2sYF AMKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=6mwCziIgbqCaPfGhbpJclA7zt0zT/DjQfjFbGVV4PrQ=; b=idN8Rm2WKcAo9EQWbU38zZu7iUGshpP2s5CdIXQLomLsgGSEpuLlMBiqmguDvW+zHt jGCmd9YalfyLynz4lEIrFT/zqJlOaumjmKG/c5HAws/wFnK14xu0ZXfk92+HFhvHQip/ by48+hCGbBFuUAtXFID+MyGzvxcpI7L98H/n+/UqiJlEM7B01Z0TIiyUG7ZzrO9POx5Y cw1PXp8M5xV1uEKuJShBKUwpxD5t4481JFyUF8HTY79ymFsrv/aYRecyP77J/gz7clqk ZJd4QLU11wilmIimDLuX2hjZdAw3L7/wVguzl10uRC9VC6nnmnwr2om1WOqdMaqfRB+S PLPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=mbkthaWg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e14si8677229edm.126.2020.09.14.16.31.46; Mon, 14 Sep 2020 16:32:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=mbkthaWg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726095AbgINX3D (ORCPT + 99 others); Mon, 14 Sep 2020 19:29:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725997AbgINX2y (ORCPT ); Mon, 14 Sep 2020 19:28:54 -0400 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F2ACC06174A for ; Mon, 14 Sep 2020 16:28:54 -0700 (PDT) Received: by mail-io1-xd42.google.com with SMTP id d190so2070510iof.3 for ; Mon, 14 Sep 2020 16:28:54 -0700 (PDT) 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; bh=6mwCziIgbqCaPfGhbpJclA7zt0zT/DjQfjFbGVV4PrQ=; b=mbkthaWgzvywMvbJyHZOeX0puvYOuoc5q0gETR5HzioqXS8ZkYvVEYF3J+yIQjWyUP kEqKwkFqykyQK59/mExPj8FoETOqv/t6lNhTWmHz1qjAFMqCoF7jriHIJRmUwiA3GVeo VlnTmNl1ZnUsyCfJ6cdAhGnYee4TQEiPK29Maz9zvvqLdNv0IbSUgwMFSuZ8JhvgP78a WKaTzspxrQtFYvWoy2K+YX2mmbE8DlshKWu9spLPDSTuo+ks53uTooHvZhVIGm03DSd0 isDitc2HqrQrd+3JmpckFY0gQaY0TguDoCByCi3dSE31S6/AsPgdGLQLl/jGaYSQQfdk NIQw== 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; bh=6mwCziIgbqCaPfGhbpJclA7zt0zT/DjQfjFbGVV4PrQ=; b=B+grGcjjnLNlW/y8VL8La2Fx4ZmYfNPGzpDsU3Wpmr79R14M7BwmgLaaK04iOHmHpg ctxXPJuEddudNLqz32gxYriZ10a3kPn1DaZav9Xnx/gkEQlhd6VOrqLZ1hQ80LkIYZ+v GzvMukTnldkOPDTS6G86RKdO3DGQvnn0T4SDFa2/1cNguM8ryGj/pGomUQdsITekFrZM A84g/QQ5XKxE/eHvqQrBsMaPcfb4lL/S4gP3ax0ZUqBypzcwHZr2mB/nUs7xCNKcoDQZ 3eRthO5l520vUfQGiRi/WMci+9fHMcYVIgx4oUNEDh29+CJZQ358kTYOLO9Nv4x8r3iz qjOw== X-Gm-Message-State: AOAM5312LsvmtMZGdjFp2jSRwPNgt+QhNw5ajp0bNk/thClZNYzDOjWE zvwgI+8tswRSCtEi4215xMFkPw== X-Received: by 2002:a02:a615:: with SMTP id c21mr15063821jam.106.1600126133326; Mon, 14 Sep 2020 16:28:53 -0700 (PDT) Received: from ziepe.ca ([206.223.160.26]) by smtp.gmail.com with ESMTPSA id p9sm6756721iov.18.2020.09.14.16.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 16:28:52 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kHxtz-006Hgi-6k; Mon, 14 Sep 2020 20:28:51 -0300 Date: Mon, 14 Sep 2020 20:28:51 -0300 From: Jason Gunthorpe To: Linus Torvalds Cc: Peter Xu , Leon Romanovsky , Linux-MM , Linux Kernel Mailing List , "Maya B . Gokhale" , Yang Shi , Marty Mcfadden , Kirill Shutemov , Oleg Nesterov , Jann Horn , Jan Kara , Kirill Tkhai , Andrea Arcangeli , Christoph Hellwig , Andrew Morton Subject: Re: [PATCH 1/4] mm: Trial do_wp_page() simplification Message-ID: <20200914232851.GH1221970@ziepe.ca> References: <20200821234958.7896-1-peterx@redhat.com> <20200821234958.7896-2-peterx@redhat.com> <20200914143829.GA1424636@nvidia.com> <20200914183436.GD30881@xz-x1> <20200914211515.GA5901@xz-x1> <20200914225542.GO904879@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 14, 2020 at 03:59:31PM -0700, Linus Torvalds wrote: > On Mon, Sep 14, 2020 at 3:55 PM Jason Gunthorpe wrote: > > > > Just as an aside, the RDMA stuff is also supposed to set MADV_DONTFORK > > on these regions, so I'm a bit puzzled what is happening here. > > Did the fork perhaps happen _before_ , so the pages are shared when > you do the pin? Looking at the progam, it seems there are a number of forks for exec before and after pin_user_pages_fast(), but the parent process always does waitpid() after the fork. > MADV_DONTFORK doesn't mean COW doesn't happen. It just means that the > next fork() won't be copying that memory area. Yes, this stuff does pin_user_pages_fast() and MADV_DONTFORK together. It sets FOLL_FORCE and FOLL_WRITE to get an exclusive copy of the page and MADV_DONTFORK was needed to ensure that a future fork doesn't establish a COW that would break the DMA by moving the physical page over to the fork. DMA should stay with the process that called pin_user_pages_fast() (Is MADV_DONTFORK still needed with recent years work to GUP/etc? It is a pretty terrible ancient thing) > That said, it's possible that the test cases do something invalid - or > maybe we've broken MADV_DONTFORK - and it all just happened to work > before. Hmm. If symptoms stop with this patch should we investigate MADV_DONTFORK? Thanks, Jason