From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E6BBC43461 for ; Mon, 14 Sep 2020 23:29:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E260220936 for ; Mon, 14 Sep 2020 23:29:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="mbkthaWg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726106AbgINX3D (ORCPT ); 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-Google-Smtp-Source: ABdhPJzUNguBOvRQmINN/RQZ6Oz1sZ8VDajcEqKrO2vPt27FjIWG90hIUgcGs0Kzr+zOltr0u22Y9Q== 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