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 9963EC43461 for ; Mon, 14 Sep 2020 23:28:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 039FA2193E for ; Mon, 14 Sep 2020 23:28:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="mbkthaWg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 039FA2193E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2A6D26B0087; Mon, 14 Sep 2020 19:28:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2309C6B0088; Mon, 14 Sep 2020 19:28:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D3356B0089; Mon, 14 Sep 2020 19:28:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0076.hostedemail.com [216.40.44.76]) by kanga.kvack.org (Postfix) with ESMTP id E01E16B0087 for ; Mon, 14 Sep 2020 19:28:54 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A20971DFB for ; Mon, 14 Sep 2020 23:28:54 +0000 (UTC) X-FDA: 77263259388.09.metal97_070dc3e2710c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 7DF16180AD804 for ; Mon, 14 Sep 2020 23:28:54 +0000 (UTC) X-HE-Tag: metal97_070dc3e2710c X-Filterd-Recvd-Size: 5253 Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Mon, 14 Sep 2020 23:28:54 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id r25so2100534ioj.0 for ; Mon, 14 Sep 2020 16:28:53 -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=J6oiK6MsuKTHSYIIsILL9KJL3u8TnHA8X61MaAaPCAbWpBEdRkcNPNcZsgx4RK5GPs 9WJIB0r7MWB1mYuzJpmJydHhrM1yDO6S6hu0Jm5k/LvRajkBURNyjwD74VvoYHgmaXeR 1HkwOH053slVxpvUxO7iIriPcIvJKeo7NnxuVmNVBRAx7+8IVF3VhEUy+1n+upr3GBGn VhgVM7iERg9JjFOcTaOU9F7kFqOvBtwD5MdR7xSrJTCse8LDh2pd7bcvfa5tuY/X2Sho 5uylDa+HnorvnyPBHJH+O0hwxfCF/8wndagDRhYptGrdeFC1HNI3rcluOa0iE0gPAgUA IEXw== X-Gm-Message-State: AOAM530o9zY158wKWYDsMdztZjY1wymnZNO2n6MzgnEuQYjqVYbmPumQ KmFyETBED5sH2f/ulI1L1TsNFg== 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: X-Rspamd-Queue-Id: 7DF16180AD804 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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